-
-
Notifications
You must be signed in to change notification settings - Fork 9.7k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Various improvements for
brew command
- Add a (large) speedup by moving some logic to Bash for the typical case of a normal or dev-cmd, Bash or Ruby command. - Make `brew command` a non-developer command, I don't think it makes sense to consider it something needed for developing Homebrew. - Update the manpage/tests/RBI accordingly. Co-authored-by: Carlo Cabrera <[email protected]>
- Loading branch information
1 parent
c9c8806
commit 4ffcd8a
Showing
8 changed files
with
72 additions
and
21 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,46 @@ | ||
# does the quickest output of brew command possible for the basic cases of an | ||
# official Bash or Ruby normal or dev-cmd command. | ||
# HOMEBREW_LIBRARY is set by brew.sh | ||
# shellcheck disable=SC2154 | ||
homebrew-command-path() { | ||
case "$1" in | ||
# check we actually have command and not e.g. commandsomething | ||
command) ;; | ||
*) return 1 ;; | ||
esac | ||
|
||
local first_command found_command | ||
for arg in "$@" | ||
do | ||
if [[ -z "${first_command}" && "${arg}" == "command" ]] | ||
then | ||
first_command=1 | ||
continue | ||
elif [[ -f "${HOMEBREW_LIBRARY}/Homebrew/cmd/${arg}.sh" ]] | ||
then | ||
echo "${HOMEBREW_LIBRARY}/Homebrew/cmd/${arg}.sh" | ||
found_command=1 | ||
elif [[ -f "${HOMEBREW_LIBRARY}/Homebrew/dev-cmd/${arg}.sh" ]] | ||
then | ||
echo "${HOMEBREW_LIBRARY}/Homebrew/dev-cmd/${arg}.sh" | ||
found_command=1 | ||
elif [[ -f "${HOMEBREW_LIBRARY}/Homebrew/cmd/${arg}.rb" ]] | ||
then | ||
echo "${HOMEBREW_LIBRARY}/Homebrew/cmd/${arg}.rb" | ||
found_command=1 | ||
elif [[ -f "${HOMEBREW_LIBRARY}/Homebrew/dev-cmd/${arg}.rb" ]] | ||
then | ||
echo "${HOMEBREW_LIBRARY}/Homebrew/dev-cmd/${arg}.rb" | ||
found_command=1 | ||
else | ||
return 1 | ||
fi | ||
done | ||
|
||
if [[ -n "${found_command}" ]] | ||
then | ||
return 0 | ||
else | ||
return 1 | ||
fi | ||
} |
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
12 changes: 0 additions & 12 deletions
12
Library/Homebrew/sorbet/rbi/dsl/homebrew/dev_cmd/command.rbi
This file was deleted.
Oops, something went wrong.
4 changes: 2 additions & 2 deletions
4
...ary/Homebrew/test/dev-cmd/command_spec.rb → Library/Homebrew/test/cmd/command_spec.rb
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters