Merge pull request #1190 from vladshablinsky/no-autoupdate-on-help
brew.sh: don't autoupdate if --help passed
This commit is contained in:
commit
881fdcd25e
@ -32,20 +32,17 @@ begin
|
|||||||
|
|
||||||
empty_argv = ARGV.empty?
|
empty_argv = ARGV.empty?
|
||||||
help_flag_list = %w[-h --help --usage -?]
|
help_flag_list = %w[-h --help --usage -?]
|
||||||
help_flag = false
|
help_flag = !ENV["HOMEBREW_HELP"].nil?
|
||||||
internal_cmd = true
|
internal_cmd = true
|
||||||
cmd = nil
|
cmd = nil
|
||||||
|
|
||||||
ARGV.dup.each_with_index do |arg, i|
|
ARGV.dup.each_with_index do |arg, i|
|
||||||
break if help_flag && cmd
|
break if help_flag && cmd
|
||||||
|
|
||||||
if help_flag_list.include?(arg)
|
if arg == "help" && !cmd
|
||||||
# Option-style help: Both `--help <cmd>` and `<cmd> --help` are fine.
|
|
||||||
help_flag = true
|
|
||||||
elsif arg == "help" && !cmd
|
|
||||||
# Command-style help: `help <cmd>` is fine, but `<cmd> help` is not.
|
# Command-style help: `help <cmd>` is fine, but `<cmd> help` is not.
|
||||||
help_flag = true
|
help_flag = true
|
||||||
elsif !cmd
|
elsif !cmd && !help_flag_list.include?(arg)
|
||||||
cmd = ARGV.delete_at(i)
|
cmd = ARGV.delete_at(i)
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|||||||
@ -183,6 +183,15 @@ then
|
|||||||
set -- "$@" -v
|
set -- "$@" -v
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
for arg in "$@"
|
||||||
|
do
|
||||||
|
if [[ $arg = "--help" || $arg = "-h" || $arg = "--usage" || $arg = "-?" ]]
|
||||||
|
then
|
||||||
|
export HOMEBREW_HELP="1"
|
||||||
|
break
|
||||||
|
fi
|
||||||
|
done
|
||||||
|
|
||||||
HOMEBREW_ARG_COUNT="$#"
|
HOMEBREW_ARG_COUNT="$#"
|
||||||
HOMEBREW_COMMAND="$1"
|
HOMEBREW_COMMAND="$1"
|
||||||
shift
|
shift
|
||||||
@ -272,6 +281,7 @@ setup-analytics
|
|||||||
report-analytics-screenview-command
|
report-analytics-screenview-command
|
||||||
|
|
||||||
update-preinstall() {
|
update-preinstall() {
|
||||||
|
[[ -z "$HOMEBREW_HELP" ]] || return
|
||||||
[[ -z "$HOMEBREW_NO_AUTO_UPDATE" ]] || return
|
[[ -z "$HOMEBREW_NO_AUTO_UPDATE" ]] || return
|
||||||
[[ -z "$HOMEBREW_UPDATE_PREINSTALL" ]] || return
|
[[ -z "$HOMEBREW_UPDATE_PREINSTALL" ]] || return
|
||||||
|
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user