Added exit & default to help if no main is specified
This commit is contained in:
@@ -187,6 +187,7 @@ module CliGen
|
||||
{% for cls in CliGen::Command.subclasses %}
|
||||
when CliGen::CommandNode({{cls.name}})
|
||||
match.as(CommandNode({{cls}})).process(args.reject(&.processed?))
|
||||
exit 0
|
||||
{% end %}
|
||||
else
|
||||
raise "ERROR : Couldn't find thing"
|
||||
@@ -259,12 +260,16 @@ module CliGen
|
||||
{% if T.has_method?(:main) %}
|
||||
cls.main
|
||||
{% else %}
|
||||
abort help
|
||||
#raise "ERROR : CommandNode({{T}})\#{{@def.name}} : No subcommand matched and no #main defined"
|
||||
puts help
|
||||
puts "ERROR : CommandNode({{T}})\#{{@def.name}} : No subcommand matched and no #main defined"
|
||||
{% end %}
|
||||
exit 0
|
||||
end
|
||||
{% end %}
|
||||
end
|
||||
{% else %}
|
||||
puts self.as(Nil).help
|
||||
exit 0
|
||||
{% end %}
|
||||
end
|
||||
end
|
||||
|
||||
Reference in New Issue
Block a user