-
Notifications
You must be signed in to change notification settings - Fork 1.5k
Undo (CLI) arguments #2041
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Comments
The way I've approached this previously is to just provide new CLI arguments to counter existing ones, if I think they might need to be countered. For example, if a standard is using But this is still an interesting idea. I just don't think it could apply to all the single letter options and it would deprecate |
Oh, right. Having a completely different flag undo what another one would do, is another option. One I wanted to mention too, but forgot. However, I don't think this is always easy or appropriate, or rather the exact counterpart of some other flag. In the That said, having the possibility to use (uppercase or not) negative flags only via command line would totally work in my case. It might just also be nice to be able to do this from a ruleset that references another one. Not a priority for me personally, but valuable in general. Thinking out loud, the In essence, all single-letter flags would do just one thing. One thing, you easily can undo. Except for |
Hey there.
It would be great to make sure some (CLI) arg is not set.
Meaning, with a ruleset that contains
<arg value="x"/>
, I would like to be able to unset that flag—both via CLI or from another ruleset that extends the other one.Real-life example:
Imagine some app that runs
phpcs
, and provides some fancy and interactive output on some web UI. This might break if it expects just the output (in whatever format), but then the ruleset also contains the-p
flag to show progress. If only the app could undo the progress flag...The main two questions are now if you want such functionality, and, if yes, how best to implement it.
One way to do so is to provide uppercase flags. This is done by some CLI tools, while others might have completely different things attached to, for example,
-a
and-A
. And yet others totally don't care about casing, and treat-A
as if it was-a
, and vice versa.So, with negative uppercase flags, a ruleset containing
<arg value="sp"/>
would not display progress, if called via CLI with-P
. Also, if the ruleset contained<arg value="P"/>
, it would also not display progress, irrelevant if any other referenced ruleset would set it.Does that make sense?
I already had a look at how
arg
s are being processed (here and here), and while it would require some changes, of course, I'm positive they would only be internal, not breaking any current behavior. Unless people already are using uppercase flags in custom extensions. (PHPCS itself is not using any uppercase flags so far.)Thanks already in advance for your time. ✌️
The text was updated successfully, but these errors were encountered: