diff --git a/Library/Homebrew/cmd/install.rb b/Library/Homebrew/cmd/install.rb index e22603a0a4..85ba7e00d1 100644 --- a/Library/Homebrew/cmd/install.rb +++ b/Library/Homebrew/cmd/install.rb @@ -78,6 +78,7 @@ module Homebrew switch :verbose, description: "Print the verification and postinstall steps." switch "--display-times", + env: :display_install_times, description: "Print install times for each formula at the end of the run." switch "-i", "--interactive", description: "Download and patch , then open a shell. This allows the user to "\ diff --git a/Library/Homebrew/cmd/reinstall.rb b/Library/Homebrew/cmd/reinstall.rb index 972451107e..a34a0a4330 100644 --- a/Library/Homebrew/cmd/reinstall.rb +++ b/Library/Homebrew/cmd/reinstall.rb @@ -35,6 +35,7 @@ module Homebrew switch :verbose, description: "Print the verification and postinstall steps." switch "--display-times", + env: :display_install_times, description: "Print install times for each formula at the end of the run." conflicts "--build-from-source", "--force-bottle" formula_options diff --git a/Library/Homebrew/cmd/upgrade.rb b/Library/Homebrew/cmd/upgrade.rb index 8099e311d2..50b0fd81fc 100644 --- a/Library/Homebrew/cmd/upgrade.rb +++ b/Library/Homebrew/cmd/upgrade.rb @@ -45,6 +45,7 @@ module Homebrew switch :verbose, description: "Print the verification and postinstall steps." switch "--display-times", + env: :display_install_times, description: "Print install times for each formula at the end of the run." conflicts "--build-from-source", "--force-bottle" formula_options diff --git a/Library/Homebrew/manpages/brew.1.md.erb b/Library/Homebrew/manpages/brew.1.md.erb index 87897ca4e6..b8f83babd2 100644 --- a/Library/Homebrew/manpages/brew.1.md.erb +++ b/Library/Homebrew/manpages/brew.1.md.erb @@ -174,6 +174,9 @@ Note that environment variables must have a value set to be detected. For exampl *Default:* the value of the user's `DISPLAY` environment variable. + * `HOMEBREW_DISPLAY_INSTALL_TIMES`: + If set, Homebrew will print install times for each formula at the end of the run. + * `HOMEBREW_EDITOR`: If set, Homebrew will use this editor when editing a single formula, or several formulae in the same directory. diff --git a/Library/Homebrew/messages.rb b/Library/Homebrew/messages.rb index 8ecd36d085..664fd50d37 100644 --- a/Library/Homebrew/messages.rb +++ b/Library/Homebrew/messages.rb @@ -22,7 +22,7 @@ class Messages def display_messages display_caveats - display_install_times if ARGV.include?("--display-times") + display_install_times if Homebrew.args.display_times? end def display_caveats diff --git a/Library/Homebrew/test/messages_spec.rb b/Library/Homebrew/test/messages_spec.rb index 69a20b92e9..f11736ac00 100644 --- a/Library/Homebrew/test/messages_spec.rb +++ b/Library/Homebrew/test/messages_spec.rb @@ -74,7 +74,7 @@ describe Messages do context "when the --display-times argument is present" do before do - allow(ARGV).to receive(:include?).with("--display-times").and_return(true) + allow(Homebrew.args).to receive(:display_times?).and_return(true) end context "when install_times is empty" do diff --git a/docs/Manpage.md b/docs/Manpage.md index c0ea5bf305..2f776f18c6 100644 --- a/docs/Manpage.md +++ b/docs/Manpage.md @@ -1061,6 +1061,9 @@ Note that environment variables must have a value set to be detected. For exampl *Default:* the value of the user's `DISPLAY` environment variable. + * `HOMEBREW_DISPLAY_INSTALL_TIMES`: + If set, Homebrew will print install times for each formula at the end of the run. + * `HOMEBREW_EDITOR`: If set, Homebrew will use this editor when editing a single formula, or several formulae in the same directory. diff --git a/manpages/brew-cask.1 b/manpages/brew-cask.1 index 23febd9eed..99f6e696b5 100644 --- a/manpages/brew-cask.1 +++ b/manpages/brew-cask.1 @@ -1,7 +1,7 @@ .\" generated with Ronn/v0.7.3 .\" http://github.com/rtomayko/ronn/tree/0.7.3 . -.TH "BREW\-CASK" "1" "May 2019" "Homebrew" "brew-cask" +.TH "BREW\-CASK" "1" "July 2019" "Homebrew" "brew-cask" . .SH "NAME" \fBbrew\-cask\fR \- a friendly binary installer for macOS diff --git a/manpages/brew.1 b/manpages/brew.1 index 385a7cd678..2710da254a 100644 --- a/manpages/brew.1 +++ b/manpages/brew.1 @@ -1,7 +1,7 @@ .\" generated with Ronn/v0.7.3 .\" http://github.com/rtomayko/ronn/tree/0.7.3 . -.TH "BREW" "1" "May 2019" "Homebrew" "brew" +.TH "BREW" "1" "July 2019" "Homebrew" "brew" . .SH "NAME" \fBbrew\fR \- The missing package manager for macOS @@ -1297,6 +1297,10 @@ If set, Homebrew will use this X11 display when opening a page in a browser, for \fIDefault:\fR the value of the user\'s \fBDISPLAY\fR environment variable\. . .TP +\fBHOMEBREW_DISPLAY_INSTALL_TIMES\fR +If set, Homebrew will print install times for each formula at the end of the run\. +. +.TP \fBHOMEBREW_EDITOR\fR If set, Homebrew will use this editor when editing a single formula, or several formulae in the same directory\. .