summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSamuel Giddins <segiddins@segiddins.me>2017-06-19 21:09:48 -0500
committerSamuel Giddins <segiddins@segiddins.me>2017-06-19 21:09:48 -0500
commit4614ed4274bae9207927436d810c0062a9000ce5 (patch)
tree8c5d8ee4ecd52e4a3480658d3a53e67bf2967595
parentdf0e27ff6b8ffea78a52dbec6999950ab32f7af1 (diff)
downloadbundler-4614ed4274bae9207927436d810c0062a9000ce5.tar.gz
[CLI] Dont print defaults in the command printed with --verbose
-rw-r--r--lib/bundler/cli.rb14
-rw-r--r--spec/bundler/cli_spec.rb5
2 files changed, 15 insertions, 4 deletions
diff --git a/lib/bundler/cli.rb b/lib/bundler/cli.rb
index 838dcb3e08..99eaa00cf9 100644
--- a/lib/bundler/cli.rb
+++ b/lib/bundler/cli.rb
@@ -621,10 +621,16 @@ module Bundler
def print_command
return unless ENV["BUNDLE_POSTIT_TRAMPOLINING_VERSION"] || Bundler.ui.debug?
_, _, config = @_initializer
- current_command = config[:current_command].name
- return if %w[exec version check platform show help].include?(current_command)
- command = ["bundle", current_command] + args
- command << Thor::Options.to_switches(options)
+ current_command = config[:current_command]
+ command_name = current_command.name
+ return if %w[exec version check platform show help].include?(command_name)
+ command = ["bundle", command_name] + args
+ options_to_print = options.dup
+ options_to_print.delete_if do |k, v|
+ next unless o = current_command.options[k]
+ o.default == v
+ end
+ command << Thor::Options.to_switches(options_to_print).strip
command.reject!(&:empty?)
Bundler.ui.info "Running `#{command * " "}` with bundler #{Bundler::VERSION}"
end
diff --git a/spec/bundler/cli_spec.rb b/spec/bundler/cli_spec.rb
index f893e7799f..beec88b8a6 100644
--- a/spec/bundler/cli_spec.rb
+++ b/spec/bundler/cli_spec.rb
@@ -59,6 +59,11 @@ RSpec.describe "bundle executable" do
bundle! "config", :verbose => true
expect(out).to start_with("Running `bundle config --verbose` with bundler #{Bundler::VERSION}")
end
+
+ it "doesn't print defaults" do
+ install_gemfile! "", :verbose => true
+ expect(out).to start_with("Running `bundle install --verbose --retry 0 --no-color` with bundler #{Bundler::VERSION}")
+ end
end
describe "printing the outdated warning" do