Added prerun command annotation & implementation
This commit is contained in:
@@ -14,6 +14,9 @@ module CliGen
|
|||||||
annotation Selection
|
annotation Selection
|
||||||
end
|
end
|
||||||
|
|
||||||
|
annotation PreRunCommand
|
||||||
|
end
|
||||||
|
|
||||||
annotation SubCommand
|
annotation SubCommand
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|||||||
@@ -244,6 +244,10 @@ module CliGen
|
|||||||
{% unless T == Nil %}
|
{% unless T == Nil %}
|
||||||
unless passed_execution
|
unless passed_execution
|
||||||
cls = T.new(handler: self.as(CliGen::BaseCommandNode))
|
cls = T.new(handler: self.as(CliGen::BaseCommandNode))
|
||||||
|
{% prerun = T.methods.select(&.annotation(CliGen::PreRunCommand)) %}
|
||||||
|
{% for cmd in prerun %}
|
||||||
|
cls.{{cmd.name}}
|
||||||
|
{% end %}
|
||||||
{% subcmds = T.methods.select(&.annotation(CliGen::SubCommand)) %}
|
{% subcmds = T.methods.select(&.annotation(CliGen::SubCommand)) %}
|
||||||
{% begin %}
|
{% begin %}
|
||||||
case matched_subcommand
|
case matched_subcommand
|
||||||
|
|||||||
Reference in New Issue
Block a user