You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I have a nested architecture where there is a common set of parameters that are shared with multiple commands. In my usage statement I want to see something like this: Usage: app [one|two] [options]
classCommonincludeTTY::Option# ... common params for all commandsendclassOne < Common# ... parameters unique for oneendclassTwo < common# ... parameters unique to twoend
How would the new feature work?
app --help
Returns a usage report for only the common parameters and gives the command name and command description that are available.
app one --help
Gives a usage report showing the common parameters and the unique parameters for command one.
Drawbacks
Could get lost in ObjectSpace ...
I tried using a class variable at the base class level; but, command is executed at elaboration time. This does not allow for the dynamic assignment of content.
Bottom line: as is, I can statically assign command "[one|two]" in the base class; but, when I add or remove command classes I have to remember to change that static text. I'd rather the computer do it for me like this:
command'[' +
ObjectSpace.each_object(Class).select{ |klass| klass < App::Command}.map{|k| k.name.downcase.split('::').last}.join('|') +
']'
DSL by its nature is executed at elaboration. What I'm wanting has to be done AFTER elaboration. That means that the DSL needs to be lazy.
I am still trying.
The text was updated successfully, but these errors were encountered:
Describe the problem
I have a nested architecture where there is a common set of parameters that are shared with multiple commands. In my usage statement I want to see something like this:
Usage: app [one|two] [options]
How would the new feature work?
app --help
Returns a usage report for only the common parameters and gives the command name and command description that are available.
app one --help
Gives a usage report showing the common parameters and the unique parameters for command one.
Drawbacks
Could get lost in ObjectSpace ...
I tried using a class variable at the base class level; but, command is executed at elaboration time. This does not allow for the dynamic assignment of content.
Bottom line: as is, I can statically assign
command "[one|two]"
in the base class; but, when I add or remove command classes I have to remember to change that static text. I'd rather the computer do it for me like this:DSL by its nature is executed at elaboration. What I'm wanting has to be done AFTER elaboration. That means that the DSL needs to be lazy.
I am still trying.
The text was updated successfully, but these errors were encountered: