diff options
| -rw-r--r-- | lib/bundler/cli.rb | 7 | ||||
| -rw-r--r-- | spec/bundler/commands/list_spec.rb | 12 |
2 files changed, 18 insertions, 1 deletions
diff --git a/lib/bundler/cli.rb b/lib/bundler/cli.rb index 23c20fc7b3..8c4e3c36a7 100644 --- a/lib/bundler/cli.rb +++ b/lib/bundler/cli.rb @@ -714,7 +714,12 @@ module Bundler command_name = cmd.name return if PARSEABLE_COMMANDS.include?(command_name) command = ["bundle", command_name] + args - command << Thor::Options.to_switches(options.sort_by(&:first)).strip + options_to_print = options.dup + options_to_print.delete_if do |k, v| + next unless o = cmd.options[k] + o.default == v + end + command << Thor::Options.to_switches(options_to_print.sort_by(&:first)).strip command.reject!(&:empty?) Bundler.ui.info "Running `#{command * " "}` with bundler #{Bundler.verbose_version}" end diff --git a/spec/bundler/commands/list_spec.rb b/spec/bundler/commands/list_spec.rb index cc0db9169d..e8ed863310 100644 --- a/spec/bundler/commands/list_spec.rb +++ b/spec/bundler/commands/list_spec.rb @@ -1,6 +1,18 @@ # frozen_string_literal: true RSpec.describe "bundle list" do + context "in verbose mode" do + it "logs the actual flags passed to the command" do + install_gemfile <<-G + source "https://gem.repo1" + G + + bundle "list --verbose" + + expect(out).to include("Running `bundle list --verbose`") + end + end + context "with name-only and paths option" do it "raises an error" do bundle "list --name-only --paths", raise_on_error: false |
