diff --git a/src/cli/command_parser.rb b/src/cli/command_parser.rb index 357d1082ab..5165a668b3 100755 --- a/src/cli/command_parser.rb +++ b/src/cli/command_parser.rb @@ -338,7 +338,11 @@ EOT }.join(' ') puts "Wrong number of arguments" - puts "The arguments should be: #{args_str}" + if args_str.empty? + puts "No argument is required" + else + puts "The arguments should be: #{args_str}" + end exit -1 end @@ -346,7 +350,15 @@ EOT argument = nil error_msg = nil format.each { |f| - format_hash = @formats[f] ? @formats[f] : @formats[:text] + if @formats[f] + format_hash = @formats[f] + elsif f.nil? + argument = nil + break + else + format_hash = @formats[:text] + end + rc = format_hash[:proc].call(arg) if rc[0]==0 argument=rc[1]