148 Commits

Author SHA1 Message Date
Douglas Eichelberger
659f993dab Avoid exposing table 2024-12-08 10:28:10 -08:00
Douglas Eichelberger
6d19b84ef1 Fix args validation 2024-12-08 10:28:10 -08:00
Douglas Eichelberger
fef1211c19 Use method result table
foo
2024-12-08 10:28:10 -08:00
Douglas Eichelberger
3ea76b8498 Avoid re-defining #formula? 2024-12-08 10:28:09 -08:00
Douglas Eichelberger
3a4243742f Remove OpenStruct from CLI::Args 2024-12-08 10:27:49 -08:00
Douglas Eichelberger
06aaeafa4f Minor CLI code improvements 2024-12-07 08:09:15 -08:00
Douglas Eichelberger
9a2b386a52 Remove unsafe references from CLI and Formulary code 2024-12-06 11:06:27 -08:00
Mike McQuaid
94416e82f0
Add new odeprecated, odisabled, remove disabled code.
Prepare the usual deprecation cycle for Homebrew 4.4.0.
2024-09-24 10:15:34 +01:00
Douglas Eichelberger
eeb31d3050 Fix violations 2024-09-20 11:07:00 -07:00
Douglas Eichelberger
7cd329c116 Makes args readable 2024-09-19 10:58:53 -07:00
Douglas Eichelberger
7acddd7eb2 Remove unused processed option element 2024-08-19 13:19:56 -07:00
Douglas Eichelberger
3943ff1406 Strict type Homebrew::CLI::Args 2024-08-18 20:30:58 -07:00
Douglas Eichelberger
becb84fc65
Update Library/Homebrew/cli/parser.rb
Co-authored-by: Mike McQuaid <mike@mikemcquaid.com>
2024-08-13 13:03:48 -07:00
Douglas Eichelberger
f7e17713a2 Update message, as there is a replacement 2024-08-10 11:55:43 -07:00
Douglas Eichelberger
d554c11b4c Add docs link 2024-08-10 11:20:53 -07:00
Douglas Eichelberger
a0a7f355d5 Create dummy brew cmd 2024-08-10 11:20:53 -07:00
Douglas Eichelberger
4fd659797f Deprecate invoking commands in the old style 2024-08-10 11:20:47 -07:00
Mike McQuaid
c5dbd3ca24
Rearrange requires
This improves the load time of most brew commands. For an example of
one of the simplest commands this speeds up:

Without Bootsnap:
```
$ hyperfine 'git checkout master; brew help' 'git checkout optimise_requires; brew help'
Benchmark 1: git checkout master; brew help
  Time (mean ± σ):     525.0 ms ±  35.8 ms    [User: 229.9 ms, System: 113.1 ms]
  Range (min … max):   465.3 ms … 576.6 ms    10 runs

Benchmark 2: git checkout optimise_requires; brew help
  Time (mean ± σ):     383.3 ms ±  25.1 ms    [User: 133.0 ms, System: 72.1 ms]
  Range (min … max):   353.0 ms … 443.6 ms    10 runs

Summary
  git checkout optimise_requires; brew help ran
    1.37 ± 0.13 times faster than git checkout master; brew help
```

With Bootsnap:
```
$ hyperfine 'git checkout master; brew help' 'git checkout optimise_requires; brew help'
Benchmark 1: git checkout master; brew help
  Time (mean ± σ):     386.0 ms ±  30.9 ms    [User: 130.2 ms, System: 93.8 ms]
  Range (min … max):   359.5 ms … 469.3 ms    10 runs

Benchmark 2: git checkout optimise_requires; brew help
  Time (mean ± σ):     330.2 ms ±  32.4 ms    [User: 93.4 ms, System: 73.0 ms]
  Range (min … max):   302.9 ms … 413.9 ms    10 runs

Summary
  git checkout optimise_requires; brew help ran
    1.17 ± 0.15 times faster than git checkout master; brew help
```
2024-07-14 08:49:39 -04:00
Mike McQuaid
9586473f77
brew style --fix 2024-05-17 14:25:54 +09:00
Douglas Eichelberger
7bfa552702 Individually namespace args for each command 2024-04-21 16:51:31 -07:00
Douglas Eichelberger
11720132bb cleanup 2024-04-21 14:34:55 -07:00
Mike McQuaid
ed6f3064e5 cli/parser: improve mutable constant comment. 2024-04-21 14:16:26 -07:00
Douglas Eichelberger
98d36c30c5 Apply suggestions from code review
Co-authored-by: Mike McQuaid <mike@mikemcquaid.com>
2024-04-21 14:16:25 -07:00
Douglas Eichelberger
cb71938fff Enable strict typing in CLI::Parser 2024-04-21 14:16:25 -07:00
Douglas Eichelberger
c59d9fa833 Prefer numbered block params over proc conversion, cont'd 2024-04-08 09:47:27 -07:00
Douglas Eichelberger
bf9ebccecd Handle dashed commands 2024-03-20 10:36:19 -07:00
Douglas Eichelberger
6b19bc5535 Style cleanup 2024-03-20 10:36:19 -07:00
Douglas Eichelberger
d873881c47 Port Homebrew::DevCmd::BumpFormulaPr 2024-03-20 10:25:17 -07:00
Douglas Eichelberger
cae62e0175 Update Command API 2024-03-20 10:16:17 -07:00
Douglas Eichelberger
625206b0bd Avoid duplicating global options 2024-03-15 16:30:09 -07:00
Mike McQuaid
ea2892f8ee
brew.rb: handle missing args. 2024-03-07 16:20:20 +00:00
Douglas Eichelberger
90996e1997 git grep -lE '\(\&[A-Za-z._]+method\(:' | xargs gsed -i -E 's|\(\&([A-Za-z._]+)public_method\(:([a-z?_]+)\)\)| { \1\2(_1) }|g' 2024-03-03 18:55:32 -08:00
Issy Long
f4218a6316
Fix RuboCop Performance/MapCompact offenses
- Rename an iterator variable since it would make the line too long.
2024-02-25 22:59:59 +00:00
Dave Nicolson
31f09f8d30 Replace “QuickLook” with “Quick Look” 2024-02-03 23:54:04 +01:00
Douglas Eichelberger
08e12b2383 Remove ActiveSupport Array access core extensions 2024-01-19 13:34:52 -08:00
Bo Anderson
5692c8ecbf
Fix style violations under newer RuboCop 2023-12-14 05:47:12 +00:00
Markus Reiter
0a4d10ba89
Deprecate --new-formula/--new-cask options. 2023-12-06 16:18:26 +01:00
apainintheneck
779d90082d cli/parser: rescue formula specification errors
This came up recently where an outdated formula definition
caused the program to crash with an ambiguous message when
a user wanted to upgrade a cask instead. Catching these errors
allows them to get handled later on improving error messages
and defaults. Now if the only formula with the given name is
invalid it will default to using the cask unless --formula is
specified.

- https://github.com/Homebrew/brew/issues/16123
2023-10-21 17:15:26 -07:00
Mike McQuaid
abeab3e6c6
cli/parser: tweak style.
Co-authored-by: Kevin <apainintheneck@gmail.com>
2023-10-08 19:12:43 +01:00
Eric Knibbe
d3959727d6
cli/parser: depopulate commands' args lists 2023-10-07 23:52:34 -04:00
Mike McQuaid
58f8832a7e
cli/parser: check env var directly if there's no EnvConfig method.
Before this change, external commands, whether official or not, cannot
use the `env:` DSL for `Homebrew::CLI::Parser` without adding their
environment variable to `Homebrew::EnvConfig`.

Instead, if the method is not defined, check the environment variable
directly. This allows `env:` to be used as expected and allows
simplifying some (new) code in e.g. `brew bundle`.
2023-09-27 12:28:24 +01:00
Mike McQuaid
7da934f7e2
Deprecate/disable/delete code.
The next release after this is merged will be 4.1.0.

Co-authored-by: Markus Reiter <me@reitermark.us>
2023-07-06 16:56:20 +01:00
Bo Anderson
68289f1165
Add without_api specifier for CLI named args 2023-06-22 01:57:28 +01:00
Douglas Eichelberger
24cf6076e8 brew style --fix 2023-04-24 20:42:39 -07:00
Markus Reiter
bdd6523ce8
Deprecate appcast. 2023-03-30 03:29:06 +02:00
Markus Reiter
3da305fa80
Add keyboard_layout stanza. 2023-03-26 08:14:24 +02:00
Douglas Eichelberger
b7d2953412 enable typing in --env 2023-03-03 19:12:33 -08:00
Douglas Eichelberger
d98b7845d3 Enable typing in misc files 2023-03-03 08:29:26 -08:00
Douglas Eichelberger
f9f73f3ef6 Tidy up 2023-02-27 21:42:47 -08:00
Douglas Eichelberger
1ab278f74c Fix style/type violations 2023-02-27 20:34:07 -08:00