Closed anibalrojas closed 6 years ago
Hi,
Cri supports this. Take a look at samples/sample_nested.rb for example:
$ bundle
$ bundle exec ruby samples/sample_nested.rb -d sub -e -p
[snip]
options: {:ddd=>true, :eee=>true, :ppp=>true}
Options that apply to the root command can be passed before the subcommand (as in -d
), but also after (as in -e
). Options that apply to the subcommand can only be passed after the subcommand (as in -p
).
Perfect, thanks a lot for your quick answer.
Is it possible to implement something like
command --option subcommand --another-option
?There is an option in my design that is "common" to all subcommands, for me it makes sense to be passed to the root command instead of repeating its definition in all subcommand blocks. For sure I could use a helper, but the pattern I am proposing looks better to me. Thanks in advance.