Added prerun command annotation & implementation
This commit is contained in:
@@ -14,6 +14,9 @@ module CliGen
|
||||
annotation Selection
|
||||
end
|
||||
|
||||
annotation PreRunCommand
|
||||
end
|
||||
|
||||
annotation SubCommand
|
||||
end
|
||||
end
|
||||
|
||||
@@ -244,6 +244,10 @@ module CliGen
|
||||
{% unless T == Nil %}
|
||||
unless passed_execution
|
||||
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)) %}
|
||||
{% begin %}
|
||||
case matched_subcommand
|
||||
|
||||
Reference in New Issue
Block a user