mirror of
https://github.com/OpenNebula/one.git
synced 2025-03-21 14:50:08 +03:00
bug #734: Fix handling nil arguments and no arguments
This commit is contained in:
parent
eaa91a534e
commit
98b495080b
@ -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]
|
||||
|
Loading…
x
Reference in New Issue
Block a user