diff --git a/lib/thor/parser/option.rb b/lib/thor/parser/option.rb index cb34d1ffd..4ced3fa8a 100644 --- a/lib/thor/parser/option.rb +++ b/lib/thor/parser/option.rb @@ -88,7 +88,7 @@ def usage(padding = 0) sample = "[#{sample}]" unless required? if boolean? - sample << ", [#{dasherize('no-' + human_name)}]" unless (name == "force") || name.start_with?("no-") + sample << ", [#{dasherize('no-' + human_name)}]" unless (name == "force") || name.start_with?("no-", "no_") end if aliases.empty? diff --git a/spec/parser/option_spec.rb b/spec/parser/option_spec.rb index 9e10972fb..e3b03c456 100644 --- a/spec/parser/option_spec.rb +++ b/spec/parser/option_spec.rb @@ -201,6 +201,7 @@ def option(name, options = {}) it "does not document a negative option for a negative boolean" do expect(parse(:'no-foo', :boolean).usage).not_to include("[--no-no-foo]") + expect(parse(:no_foo, :boolean).usage).not_to include("[--no-no-foo]") end it "documents a negative option for a positive boolean starting with 'no'" do