Curl: Allow option to omit --retry in curl_args
This commit is contained in:
parent
9d92ed868b
commit
e687774e8a
@ -21,7 +21,7 @@ module Utils
|
|||||||
@curl
|
@curl
|
||||||
end
|
end
|
||||||
|
|
||||||
def curl_args(*extra_args, show_output: false, user_agent: :default)
|
def curl_args(*extra_args, **options)
|
||||||
args = []
|
args = []
|
||||||
|
|
||||||
# do not load .curlrc unless requested (must be the first argument)
|
# do not load .curlrc unless requested (must be the first argument)
|
||||||
@ -31,25 +31,25 @@ module Utils
|
|||||||
|
|
||||||
args << "--show-error"
|
args << "--show-error"
|
||||||
|
|
||||||
args << "--user-agent" << case user_agent
|
args << "--user-agent" << case options[:user_agent]
|
||||||
when :browser, :fake
|
when :browser, :fake
|
||||||
HOMEBREW_USER_AGENT_FAKE_SAFARI
|
HOMEBREW_USER_AGENT_FAKE_SAFARI
|
||||||
when :default
|
when :default, nil
|
||||||
HOMEBREW_USER_AGENT_CURL
|
HOMEBREW_USER_AGENT_CURL
|
||||||
else
|
when String
|
||||||
user_agent
|
options[:user_agent]
|
||||||
end
|
end
|
||||||
|
|
||||||
args << "--header" << "Accept-Language: en"
|
args << "--header" << "Accept-Language: en"
|
||||||
|
|
||||||
unless show_output
|
unless options[:show_output] == true
|
||||||
args << "--fail"
|
args << "--fail"
|
||||||
args << "--progress-bar" unless Context.current.verbose?
|
args << "--progress-bar" unless Context.current.verbose?
|
||||||
args << "--verbose" if Homebrew::EnvConfig.curl_verbose?
|
args << "--verbose" if Homebrew::EnvConfig.curl_verbose?
|
||||||
args << "--silent" unless $stdout.tty?
|
args << "--silent" unless $stdout.tty?
|
||||||
end
|
end
|
||||||
|
|
||||||
args << "--retry" << Homebrew::EnvConfig.curl_retries
|
args << "--retry" << Homebrew::EnvConfig.curl_retries unless options[:retry] == false
|
||||||
|
|
||||||
args + extra_args
|
args + extra_args
|
||||||
end
|
end
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user