43 Commits

Author SHA1 Message Date
Markus Reiter
480e264d9a
Lint Ruby docs. 2024-05-01 11:35:21 +02:00
Douglas Eichelberger
6a1d43337c Port Homebrew::Cmd::Prefix 2024-04-01 16:00:47 -07: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
Eric Knibbe
c493b5e680
cmd+dev-cmd: fixes for output formatting 2023-09-11 02:29:57 -04:00
Douglas Eichelberger
24cf6076e8 brew style --fix 2023-04-24 20:42:39 -07:00
Douglas Eichelberger
54fad14ff3 Fix module_function errors 2023-03-06 15:11:10 -08:00
Douglas Eichelberger
1c44a8861d Fix type errors 2023-03-06 15:03:19 -08:00
Douglas Eichelberger
d56e2884aa Enable typing in cmd/ 2023-03-06 15:01:08 -08:00
Nanda H Krishna
fe0eb9b5b0
Fix style issues 2022-12-22 23:52:26 -05:00
Carlo Cabrera
d88576a89b
keg, cmd/--prefix: handle python3.10 2021-07-03 23:33:09 +01:00
John Bampton
1691e615fe Fix spelling 2021-05-08 11:20:01 +10:00
Mike McQuaid
ca47b47f77
Speedup brew --prefix <formula>
This case is _really_ slow even although it's something we encourage
people to run often and build systems often do. The `brew --prefix`
case is really fast because it's just in Bash so: let's pull the
`brew --prefix <formula>` case into Bash too.

This doesn't handle any edge-cases like `--installed` and the formula
detection is pretty simple.

Also, to make this behaviour consistent, never output `Cellar` paths
from the (Ruby) `brew --prefix`; we never want people relying on the
Cellar paths anyway, only output them if the formula wasn't installed
(where, arguably, using a Cellar path is even worse) and the speedup is
worth this deviation in behaviour.
2021-02-25 17:07:28 +00:00
Carlo Cabrera
7dd69d2c94
cmd/--prefix: ignore shared-mime-info and mactex
The shared-mime-info formula and the mactex cask currently install into
locations that are picked up by `brew --prefix --unbrewed`. This leads
to a very large number of files being found.

Before:
```
❯ brew --prefix --unbrewed | wc -l
206735
```

After
```
❯ brew --prefix --unbrewed | wc -l
3
```
2021-02-02 17:33:54 +00:00
Adrian Ho
28a8409b6e cmd/--prefix: add --installed flag
This changes the output for uninstalled formulae from Cellar prefix to empty string, so:
```sh
$ brew --prefix abcde python@3.9 tcl-tk
/usr/local/Cellar/abcde/2.9.3_1
/usr/local/opt/python@3.9
/usr/local/Cellar/tcl-tk/8.6.10
$ brew --prefix --installed abcde python@3.9 tcl-tk

/usr/local/opt/python@3.9

$
```
2021-01-31 16:09:43 +08:00
Rylan Polster
d1f3e39b7b
Update commands to generate usage banner 2021-01-18 21:20:11 -05:00
Dawid Dziurla
332372469f
cmd: indicate multiple named args in usage banner 2021-01-15 13:04:00 +01:00
Rylan Polster
da811373d3 Add named_args DSL for commands 2021-01-13 17:09:42 -05:00
EricFromCanada
c65d4617bd
list: deprecate --unbrewed in favour of brew --prefix --unbrewed 2020-12-01 12:02:45 +00:00
Markus Reiter
5be4c9b5e0 Upgrade typed sigils. 2020-11-25 17:04:19 +01:00
Markus Reiter
da9289eff0 Add more type signatures. 2020-11-13 12:26:36 +01:00
Markus Reiter
24ae318a3d Move type annotations into files. 2020-10-10 14:59:39 +02:00
Seeker
5acdcd26d0 formula: rename installed_prefix to latest_installed_prefix 2020-09-01 09:32:32 -07:00
William Ma
fa7bd3bff6 args: Migrate usage of args loading methods to args.named 2020-08-23 09:02:20 -04:00
Markus Reiter
d4c2ffd705 Refactor CLI::Parser. 2020-07-31 15:07:17 +02:00
EricFromCanada
9d6eb41fc5 cmd/dev-cmd: misc. usage and wording fixes 2020-04-19 13:31:54 -04:00
Mike McQuaid
a7fe0ed847
cmd: use more and cleanup new args APIs. 2020-03-05 09:40:15 +00:00
Gautham Goli
959b88266d
ARGV: Replace usages of ARGV.resolved_formulae with Homebrew.args 2020-01-02 13:56:19 +00:00
Gautham Goli
685a6b4da6 ARGV: Replace usages of ARGV.named with Homebrew.args.named 2019-12-18 20:38:21 +05:30
Mike McQuaid
36dbad3922
Add frozen_string_literal to all files. 2019-04-20 13:27:36 +09:00
Mike McQuaid
e40b171127
Rename cli_parser to cli/parser. 2019-04-17 22:16:50 +09:00
Mike McQuaid
b521ba0c7a
--prefix: use CLI::Parser. 2019-01-30 21:38:44 +00:00
Shaun Jackman
f6093961ef Add Homebrew::DEFAULT_PREFIX for Linux
The default prefix is /usr/local on macOS
and /home/linuxbrew/.linuxbrew on Linux.
2018-09-11 09:57:08 -07:00
Mike McQuaid
e07a587f42 --prefix: use opt_prefix when available.
Fixes #1952.
2017-02-12 16:17:56 +00:00
Mike McQuaid
a571965df9 formula: make prefix usually return opt_prefix.
Return `opt_prefix` if it exists and `prefix` is not called from within
the same formula's `install` or `post_install` methods. Otherwise, fall
back to the existing functionality.

This avoids the need to use `opt_prefix` etc. everywhere and generally
means we don't expose an implementation detail (i.e. the full Cellar
path) to dependents that have a habit of hard-coding it.
2016-12-31 16:38:05 +00:00
Markus Reiter
0ab750bf24 Use module_function for commands. 2016-10-02 00:24:47 +02:00
Martin Afanasjew
6931e9421a --prefix: move help to documentation comment 2016-04-20 13:45:26 +02:00
BrewTestBot
13d544e11e Core files style updates.
Closes Homebrew/homebrew#42354.

Signed-off-by: Mike McQuaid <mike@mikemcquaid.com>
2015-08-03 13:22:35 +01:00
Xu Cheng
5ca7035e32 --prefix: use ARGV.resolved_formulae 2015-05-27 13:53:41 +08:00
Jack Nagel
10a1952d2c Only "extend self" once on the Homebrew module 2014-06-19 13:10:36 -05:00
Misty De Meo
93502785c4 --prefix: don't use opt prefix if it doesn't exist 2012-09-13 10:19:11 -05:00
Max Howell
dd917bc105 Use opt prefix for --prefix
Rationale: everyone thinks it points to the currently installed prefix, not the prefix of the formula that is newest and maybe not installed.

The previous behavior was unintentional and evidence proves it is not intuitive either.

I anticipate no regressions. And hope I am right!
2012-09-12 22:09:46 -04:00
Dave Lee
30a4161c83 Use Formula#installed_prefix for brew --prefix formula
Signed-off-by: Adam Vandenberg <flangy@gmail.com>
2011-03-28 22:47:21 -07:00
Max Howell
768910283a Refactor the brew command into one file per command
The code was sucking. To the extent that maintenance was hard. It's a lot
easier to work with code that is sensibly split at sensible boundaries. So
now it is more like that.

But the refactor is minimal. Because we don't want you to have more merge
hell than absolutely necessary.

If you merge you will need to pay attention to brew.h.rb (as it is deleted)
and bin/brew (as command logic is gone). It will be painful, but you will just
have to help git out by moving any changes around manually.

Note compatibility.rb. It ensures that any function renames or removals don't
break anything. We're pretty serious about backwards compatibility. And that's
because we encourage you to hack around with the innards. And we couldn't do
that if we would then just make stuff disappear behind your back.
2011-03-12 11:55:02 -08:00