Testing
This commit is contained in:
@@ -14,8 +14,8 @@ module CliGen
|
||||
|
||||
ADDITIONAL_DEFAULT_FLAGS = [] of AdditionalDefaultFlag
|
||||
|
||||
def self.add_default_flag(short : String, long : String, description : String, &work : String -> )
|
||||
raise "ERROR : add_default_flag : You must provide a description" unless description
|
||||
def self.add_default_flag(short : String = "", long : String = "", description : String = "", &work : String -> )
|
||||
raise "ERROR : add_default_flag : You must provide a description" if description.empty?
|
||||
ADDITIONAL_DEFAULT_FLAGS << AdditionalDefaultFlag.new(
|
||||
short: short,
|
||||
long: long,
|
||||
@@ -64,7 +64,13 @@ module CliGen
|
||||
}
|
||||
|
||||
CliGen::ADDITIONAL_DEFAULT_FLAGS.each do |flag|
|
||||
{{parser}}.on(flag.short, flag.long, flag.description){|var| flag.work.call(var) }
|
||||
if [ flag.short, flag.long ].all?(&.!= "")
|
||||
{{parser}}.on(flag.short, flag.long, flag.description){|var| flag.work.call(var) }
|
||||
elsif flag.short != ""
|
||||
{{parser}}.on(flag.short, flag.description){|var| flag.work.call(var) }
|
||||
elsif flag.long != ""
|
||||
{{parser}}.on(flag.long, flag.description){|var| flag.work.call(var) }
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
|
||||
Reference in New Issue
Block a user