mirror of
https://github.com/Homebrew/brew.git
synced 2025-07-14 16:09:03 +08:00
Tap#install: support quiet option
This commit is contained in:
parent
bbe4191c61
commit
43c6061bc9
@ -140,17 +140,21 @@ class Tap
|
|||||||
# @param [Hash] options
|
# @param [Hash] options
|
||||||
# @option options [String] :clone_targe If passed, it will be used as the clone remote.
|
# @option options [String] :clone_targe If passed, it will be used as the clone remote.
|
||||||
# @option options [Boolean] :full_clone If set as true, full clone will be used.
|
# @option options [Boolean] :full_clone If set as true, full clone will be used.
|
||||||
|
# @option options [Boolean] :quiet If set, suppress all output.
|
||||||
def install(options = {})
|
def install(options = {})
|
||||||
require "descriptions"
|
require "descriptions"
|
||||||
raise TapAlreadyTappedError, name if installed?
|
raise TapAlreadyTappedError, name if installed?
|
||||||
clear_cache
|
clear_cache
|
||||||
|
|
||||||
|
quiet = options.fetch(:quiet, false)
|
||||||
|
|
||||||
# ensure git is installed
|
# ensure git is installed
|
||||||
Utils.ensure_git_installed!
|
Utils.ensure_git_installed!
|
||||||
ohai "Tapping #{name}"
|
ohai "Tapping #{name}" unless quiet
|
||||||
remote = options[:clone_target] || "https://github.com/#{user}/homebrew-#{repo}"
|
remote = options[:clone_target] || "https://github.com/#{user}/homebrew-#{repo}"
|
||||||
args = %W[clone #{remote} #{path}]
|
args = %W[clone #{remote} #{path}]
|
||||||
args << "--depth=1" unless options.fetch(:full_clone, false)
|
args << "--depth=1" unless options.fetch(:full_clone, false)
|
||||||
|
args << "-q" if quiet
|
||||||
|
|
||||||
begin
|
begin
|
||||||
safe_system "git", *args
|
safe_system "git", *args
|
||||||
@ -165,10 +169,10 @@ class Tap
|
|||||||
link_manpages
|
link_manpages
|
||||||
|
|
||||||
formula_count = formula_files.size
|
formula_count = formula_files.size
|
||||||
puts "Tapped #{formula_count} formula#{plural(formula_count, "e")} (#{path.abv})"
|
puts "Tapped #{formula_count} formula#{plural(formula_count, "e")} (#{path.abv})" unless quiet
|
||||||
Descriptions.cache_formulae(formula_names)
|
Descriptions.cache_formulae(formula_names)
|
||||||
|
|
||||||
if !options[:clone_target] && private?
|
if !options[:clone_target] && private? && !quiet
|
||||||
puts <<-EOS.undent
|
puts <<-EOS.undent
|
||||||
It looks like you tapped a private repository. To avoid entering your
|
It looks like you tapped a private repository. To avoid entering your
|
||||||
credentials each time you update, you can use git HTTP credential
|
credentials each time you update, you can use git HTTP credential
|
||||||
|
Loading…
x
Reference in New Issue
Block a user