Skip to content

Commit

Permalink
Merge pull request #210 from dividedmind/full-synopsis-required-options
Browse files Browse the repository at this point in the history
Don't mark required options with brackets in full synopsis
  • Loading branch information
davetron5000 committed Feb 21, 2015
2 parents 73a9e15 + 716f6e3 commit 3b7c467
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 2 deletions.
5 changes: 3 additions & 2 deletions lib/gli/commands/help_modules/full_synopsis_formatter.rb
Original file line number Diff line number Diff line change
Expand Up @@ -27,10 +27,11 @@ def synopses_for_command(command)

def sub_options_doc(sub_options)
sub_options_doc = sub_options.map { |_,option|
option.names_and_aliases.map { |name|
doc = option.names_and_aliases.map { |name|
CommandLineOption.name_as_string(name,false) + (option.kind_of?(Flag) ? " #{option.argument_name }" : '')
}.join('|')
}.map { |invocations| "[#{invocations}]" }.sort.join(' ').strip
option.required?? doc : "[#{doc}]"
}.sort.join(' ').strip
end

private
Expand Down
4 changes: 4 additions & 0 deletions lib/gli/switch.rb
Original file line number Diff line number Diff line change
Expand Up @@ -31,5 +31,9 @@ def arguments_for_option_parser
def negatable?
@negatable
end

def required?
false
end
end
end

0 comments on commit 3b7c467

Please sign in to comment.