- There's already a method on `CLI::Parser`, we don't need to hand-roll
the "number of dashes" detection.
Co-authored-by: Rylan Polster <rslpolster@gmail.com>
- Suppress (some more) warnings when doing `brew install --quiet`
- Clarify `man brew` output that we don't suppress all warnings
for all commands with `--quiet`
While I was doing this I noticed references to the (soon to be
deprecated) `brew switch` so:
- remove these references in `install` output
- remove a reference in the documentation
- add a comment to remind me to deprecate `brew diy`, too
Fixes#9179
Modify parser.rb to add a colon between each term and the line break, which `ronn` converts into a definition list.
The <br> that follows ensures each term description is on a new line in the manpage output, and also replaces the
double trailing space for generating the hard return that follows each term in the HTML output.
Also modify man.rb to print environment variables with list markup matching the cask commands, and then drop
trailing colons from both lists of terms (cask commands, env vars) and non-list terms (analytics, bundle, services;
a <br> is added here because it would prevent the term description from being indented in the manpage output).
https://docs.brew.sh/Manpage#cask-command-options-cask
Fix `-1` and other flags so they're handled correctly with casks. Use
the "right" exceptions for declaring invalid combinations and change
their parent class so that `--help` is printed nicely too.
Fixes#9033
Fix breaking options on taps again (second time in two weeks, sob).
To avoid doing this again: also add a test for this case (that I've
verified would have caught these cases).
Refactor the CLI::Args module so it doesn't have different paths to
check arguments depending on whether the arguments have been parsed or
not. Instead, set the values we need from the global ARGV at
first, global initialisation time where they will be thrown away when
the actual arguments are parsed.
To do this some other general refactoring was needed:
- more methods made private when possible
- e.g. `HEAD?` used consistently instead of `head` before arguments
are parsed.
- formula options are only parsed after named arguments are extracted
- Rename `cmdline_args` to `argv` to make it more obvious where they
come from.
- Make the `if args_parsed` early return into `unless args_parsed` to
(hopefully) make it clearer that this is not the "normal" case and
to not check `argv` unless arguments haven't been parsed.