diff --git a/src/cligen/command_node.cr b/src/cligen/command_node.cr index 58301c3..7d832d2 100644 --- a/src/cligen/command_node.cr +++ b/src/cligen/command_node.cr @@ -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