- warn if running `brew postinstall` explicitly and there's no
`post_install` defined in the formula
- add a `post_install` alias for `brew postinstall` to make life
easier for those jumping between `postinstall` and `post_install` in
e.g. Homebrew development
- refactor `post_install` formula path logic into a new method for
improved readability
- handle the JSON API `post_install` formula path case
A comment here would help the reader to understand the need for this
splitting logic, which is not so straightforward.
Addresses review comment in
https://github.com/Homebrew/brew/pull/15146#discussion_r1157361656.
Signed-off-by: Ruoyu Zhong <zhongruoyu@outlook.com>
Currently, zsh and fish shell completions show incomplete descriptions
for certain commands. For example:
docs -- Open Homebrew's online documentation (https://docs
rbenv-sync -- Create symlinks for Homebrew's installed Ruby versions in ~/
This is because `Commands.command_description` produces incomplete
short descriptions for the commands having a dot (from a URL or a path)
in the first sentence; the dot is misinterpreted as a full stop:
brew(main):001:0> Commands.command_description("docs", short: true)
=> "Open Homebrew's online documentation (https://docs"
brew(main):002:0> Commands.command_description("rbenv-sync", short: true)
=> "Create symlinks for Homebrew's installed Ruby versions in ~/"
We can improve the sentence splitting logic by only splitting at dots
either at the end or followed by a whitespace. Now With this change:
brew(main):001:0> Commands.command_description("docs", short: true)
=> "Open Homebrew's online documentation (https://docs.brew.sh) in a browser"
brew(main):002:0> Commands.command_description("rbenv-sync", short: true)
=> "Create symlinks for Homebrew's installed Ruby versions in ~/.rbenv/versions"
Signed-off-by: Ruoyu Zhong <zhongruoyu@outlook.com>
Make `brew alias`, `brew autoupdate` and `brew command-not-found-init`
official commands. This means we:
- make sure we don't break their style with `brew style` changes
- autotap them when you run the command and they aren't installed
- include them in the manpage
Don’t rely on having external commands always present in the PATH in
order to find them. Instead, provide an accessory method to Tap so
they can be added and used when needed.
While we’re here, do some general refactoring and cleanup of the
command code in these places.