mirror of
https://github.com/OpenNebula/one.git
synced 2025-03-21 14:50:08 +03:00
feature #661: Check number of arguments
This commit is contained in:
parent
5a958f7032
commit
aca8140a5d
@ -293,6 +293,20 @@ module CommandParser
|
||||
else
|
||||
id=0
|
||||
@args.collect!{|arg|
|
||||
unless format=args_format[id]
|
||||
args_str=args_format.collect{ |a|
|
||||
if a.include?(nil)
|
||||
"[#{a.compact.join("|")}]"
|
||||
else
|
||||
"<#{a.join("|")}>"
|
||||
end
|
||||
}.join(' ')
|
||||
|
||||
puts "Wrong number of arguments"
|
||||
puts "The arguments should be: #{args_str}"
|
||||
exit -1
|
||||
end
|
||||
|
||||
format = args_format[id]
|
||||
argument = nil
|
||||
error_msg = nil
|
||||
|
Loading…
x
Reference in New Issue
Block a user