148 Commits

Author SHA1 Message Date
Douglas Eichelberger
0eccc0e987 git grep -l Utils::Inflection | xargs gsed -i 's|Utils::Inflection|Utils|g' 2023-02-27 20:18:27 -08:00
Douglas Eichelberger
2400c6daed brew style --fix 2023-02-27 20:17:33 -08:00
Douglas Eichelberger
37015b6b08 Change to pluralize, port more call sites 2023-02-27 20:17:33 -08:00
EricFromCanada
dfc9906184
internal messaging fixes 2023-02-10 23:17:16 -05:00
Issy Long
1ce6a38730
cli/parser: Casks can be specified with --cask or --casks 2023-01-28 12:55:57 +00:00
Issy Long
8881ea74b5
cli/parser: Don't treat args with --cask as formulae
- For the command `brew install --cask racket`, a user was reporting the
  behaviour where despite `--cask` in the command, they were getting
  output about the `racket` formula having been renamed:

```
$ brew install --cask racket
Warning: Use minimal-racket instead of deprecated racket
==> Downloading https://mirror.racket-lang.org/installers/8.7/racket-8.7-x86_64-macosx-cs.
==> Installing Cask racket
[...]
racket was successfully installed!
```

- The "instead of deprecated ..." messaging comes from the `TapLoader`
  class `formula_name_path` method, so _something_ must be assuming
  that everything is initially a formula before _later_ learning from
  further args parsing that there's a `--cask` qualifier to scope to
  only casks.

- There are always `@formula_options` and args parsing is recursive,
  going through each option, so we check that the original `argv` items
  include a `--cask` and skip calling the `formulae` method if that's
  the case.

- After this change, the "formula renames" words no longer show up.

```
$ brew install --cask racket
==> Downloading https://mirror.racket-lang.org/installers/8.7/racket-8.7-aarch64-macosx-cs.dmg
==> Installing Cask racket
[...]
racket was successfully installed!
```
2023-01-27 21:49:20 +00:00
apainintheneck
ad57705029 All --cask for linux dev cmds
This ability was removed around a month
ago but needs to be added back in.

Developers want to be able to use the
`bump` and `audit` commands when on Linux.
This is especially useful for CI.
2023-01-08 17:34:52 -08:00
apainintheneck
a8384c0ce7 cli/parser: Better error message for cask on linux
1. Validate options before constraint violations. This allows
us to error out when --cask is passed on Linux before getting
a constraint violation when --cask and --formula are set.
2. Skip printing the help page when --cask is passed on Linux.
2022-12-31 12:34:18 -08:00
apainintheneck
b7e28ef48f Make :formula? the default on Linux
This makes :formula? the default whenever
defined throughout the codebase on Linux.
It also makes :cask? illegal for all Linux
users.
2022-12-04 19:43:12 -08:00
Bo Anderson
eac32f0b20
Additional fixes for Ruby 3 compatibility 2022-10-18 01:54:59 +01:00
Bo Anderson
9b99594753
Preliminary compatibility fixes for Ruby 3 2022-10-11 02:53:27 +01:00
apainintheneck
020c50e588 Warn linux users about using --cask 2022-10-01 16:11:39 -07:00
apainintheneck
1d5c668110 Remove unused parser option required_for 2022-06-08 15:23:58 -07:00
apainintheneck
9c4402a049 Resolved Sorbet type bug
Related to sorbet/sorbet#498

Had to change the call to caller_locations to filter out
sorbet runtime checking.
2022-04-25 00:29:05 -07:00
Rylan Polster
feb93167ad
Rename and fix Formatter:wrap to Formatter.format_help_text 2022-01-08 23:13:08 -05:00
FnControlOption
326321c1fd cli/parser: allow commands that look like options 2021-08-25 14:34:57 -07:00
Bo Anderson
e8b82bbe1e
Fix brew style 2021-08-13 13:49:52 +01:00
Mike McQuaid
30a65342e8
Deprecate, disable, delete code for Homebrew 3.2.0
Do the usual deprecation, disable, delete dance for Homebrew 3.2.0.
2021-06-17 11:34:32 +01:00
Rylan Polster
08b44afcdf
cli/parser: allow options to be hidden 2021-06-08 22:02:32 -04:00
Mike McQuaid
d73351251c
Deprecate, disable, delete code for next major/minor version.
Do the usual dance for bumping our major/minor version.
2021-04-09 09:30:36 +01:00
Bo Anderson
8e98ce69f3
Stricter handling of CLI args 2021-03-18 16:41:57 +00:00
Mike McQuaid
9663567501
Fix brew style. 2021-03-01 13:43:47 +00:00
nandahkrishna
8e5451df2f
style: use parentheses for assignment in conditions 2021-02-12 18:33:37 +05:30
Mike McQuaid
d6957a3acb
Homebrew 3.0.0 deprecations/disables 2021-01-29 19:50:24 +00:00
Rylan Polster
3e8b91679d
completions: generate zsh completions 2021-01-25 13:46:51 -05:00
Rylan Polster
01e894e9c6
parser: create NumberOfNamedArgumentsError
And commit `brew man` changes
2021-01-23 15:26:21 -05:00
Rylan Polster
b7b624c9bf
parser: clarify errors for invalid number of args 2021-01-23 15:06:44 -05:00
Seeker
50cd836427
Merge pull request #10351 from SeekingMeaning/sig-braces
rubocop: require braces for Sorbet `sig`
2021-01-19 03:50:20 -08:00
Rylan Polster
1e4fef8123
usage string generator: fix handling of dashed-commands 2021-01-18 21:20:12 -05:00
Rylan Polster
a9a0c415e7
Cleanup usage strings for flags 2021-01-18 21:20:11 -05:00
Rylan Polster
6f69aab6cf
Cleanup usage string
Include only global args and list the specific options if there are two or fewer.
2021-01-18 21:20:11 -05:00
Rylan Polster
b7977244ea
parser: automatically generate usage banners 2021-01-18 21:16:24 -05:00
Seeker
fbafaff4fe rubocop: require braces for Sorbet sig 2021-01-18 16:52:45 -08:00
Rylan Polster
eebc161ea5 Incorporate suggestions from code review
Co-Authored-By: Seeker <meaningseeking@protonmail.com>
2021-01-15 00:13:30 -05:00
Rylan Polster
3af16832d9 Generate bash completions automatically 2021-01-15 00:03:28 -05:00
Rylan Polster
74c1010256 parser: add tests for named methods 2021-01-14 15:14:10 -05:00
Rylan Polster
da811373d3 Add named_args DSL for commands 2021-01-13 17:09:42 -05:00
Rylan Polster
ab97c30b14 cli/parser: use - instead of _ in cask args 2020-12-25 12:42:18 -05:00
Issy Long
531cae4b8c
cli/parser: Option-ify arg names when raising OptionConstraintError
- 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>
2020-12-24 16:52:39 +00:00
Issy Long
27afcf5779
cli/parser: Improve single or multi "-" detection
- This reads nicer (to me).
2020-12-24 15:54:24 +00:00
Issy Long
570a660758
cli/parser: Only prefix short options with one dash
- This avoids error messages like:

```
➜ brew list -l
Error: Invalid usage: `--l` cannot be passed without `--formula`.
```
2020-12-24 13:33:37 +00:00
Seeker
8fc478fef1 cli: fix underlined multi-line help text 2020-12-18 20:54:34 -08:00
EricFromCanada
9dec442e71 pr-pull: prepare replacement for --workflow flag 2020-12-11 16:50:03 -05:00
EricFromCanada
b7aae0c643
parser: allow a disabled switch to specify its replacement 2020-12-01 12:02:44 +00:00
Markus Reiter
1b9002c04a Fix type errors in postinstall. 2020-11-29 21:23:54 +01:00
Mike McQuaid
caae165eb2
Improve brew install --quiet
- 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
2020-11-18 10:13:57 +00:00
Markus Reiter
0184e271d8 Fix RuboCop offenses. 2020-11-17 11:09:55 +01:00
EricFromCanada
f784b7107f manpage: fixes for grammar 2020-11-16 07:56:50 -05:00
EricFromCanada
eb16624c5f manpage: reformat lists of subcommands & env vars
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
2020-11-16 07:56:50 -05:00
Markus Reiter
da9289eff0 Add more type signatures. 2020-11-13 12:26:36 +01:00