From 4ae6c2d8f04c98b89dc1ac3cd96079ea0b0aa39b Mon Sep 17 00:00:00 2001 From: Daniel Molina Date: Tue, 23 Aug 2011 16:25:11 +0200 Subject: [PATCH] feature #754: Options can be defined without short value --- src/cli/command_parser.rb | 15 ++++++++++++--- 1 file changed, 12 insertions(+), 3 deletions(-) diff --git a/src/cli/command_parser.rb b/src/cli/command_parser.rb index 357d1082ab..ef59846023 100755 --- a/src/cli/command_parser.rb +++ b/src/cli/command_parser.rb @@ -166,6 +166,7 @@ EOT extra_options = comm[:options] if comm parse(extra_options) + if comm check_args!(comm_name, comm[:arity], comm[:args_format]) @@ -209,15 +210,23 @@ EOT next else shown_opts << o[:name] - short = o[:short].split(' ').first - printf opt_format, "#{short}, #{o[:large]}", o[:description] + + str = "" + str << o[:short].split(' ').first << ', ' if o[:short] + str << o[:large] + + printf opt_format, str, o[:description] puts end } } @opts.each{ |o| - printf opt_format, "#{o[:short]}, #{o[:large]}", o[:description] + str = "" + str << o[:short] if o[:short] + str << o[:large] + + printf opt_format, str, o[:description] puts } end