Releases: davetron5000/gli
Releases · davetron5000/gli
v2.6.0.rc1
Redesign of how subcommands are handled to enable each subcommand to have its own space of arguments and options.
To enable this, you must subcommand_option_handling :normal
subcommand_option_handling :normal
This is inserted into new applications, but isn't the default for backwards compatibility.
Before
Subcommands can't use flags or switches the parent uses:
command :tasks do |c|
c.flag :long
c.command :list do |list|
c.flag :long # <---- runtime error
c.action do |*|
end
end
end
Subcommands can't use a flag/switch with the same name as another subcommand with the same parent:
command :tasks do |c|
c.command :list do |list|
c.flag :long
c.action do |*|
end
end
c.command :new do |new|
c.flag :long # <----- runtime error
c.action do |*|
end
end
end
After
Each subcommand has its own "flagspace":
command :tasks do |c|
c.flag :long
c.command :list do |list|
c.flag :long
c.action do |*|
end
end
c.command :new do |new|
c.flag :long # <----- runtime error
c.action do |*|
end
end
end
You might do this:
> my_app tasks --long given-to-command list --long given-to-list-subcommand
> my_app tasks --long given-to-command new --long given-to-list-subcommand
The reason for an RC is that it required a fair amount of re-working of the code, so I want to be sure nothings subtle was broken.
Old behavior is the default: https://github.com/davetron5000/gli/blob/fully-nested-subcommands/lib/gli/app.rb#L262