diff options
Diffstat (limited to 'lib/rubygems/commands/sources_command.rb')
-rw-r--r-- | lib/rubygems/commands/sources_command.rb | 8 |
1 files changed, 6 insertions, 2 deletions
diff --git a/lib/rubygems/commands/sources_command.rb b/lib/rubygems/commands/sources_command.rb index 3be3a5dc79..f74fb12e42 100644 --- a/lib/rubygems/commands/sources_command.rb +++ b/lib/rubygems/commands/sources_command.rb @@ -34,6 +34,10 @@ class Gem::Commands::SourcesCommand < Gem::Command options[:update] = value end + add_option '-f', '--[no-]force', "Do not show any confirmation prompts and behave as if 'yes' was always answered" do |value, options| + options[:force] = value + end + add_proxy_option end @@ -71,7 +75,7 @@ class Gem::Commands::SourcesCommand < Gem::Command Do you want to add this source? QUESTION - terminate_interaction 1 unless ask_yes_no question + terminate_interaction 1 unless options[:force] || ask_yes_no(question) end end @@ -86,7 +90,7 @@ https://rubygems.org is recommended for security over #{uri} Do you want to add this insecure source? QUESTION - terminate_interaction 1 unless ask_yes_no question + terminate_interaction 1 unless options[:force] || ask_yes_no(question) end end |