clamp icon indicating copy to clipboard operation
clamp copied to clipboard

[RFE] option groups

Open ares opened this issue 11 years ago • 3 comments

What do you think of adding groups to options so when you display help you can divide them? Especially useful when you have more than 15 options I think.

ares avatar Oct 03 '13 11:10 ares

Yeah, I think option groups would be a great addition.

I imagine the DSL might look something like:

option_group "Authentication" do

  option "--access-key", "KEY", "AWS access key"
  option "--secret-key", "KEY", "AWS secret key"

end

option_group "Output" do

  option ["-f", "--format"], "FORMAT", "output format", :default => "json"
  option ["--verbose"], :flag, "be chatty"

end

mdub avatar Oct 04 '13 10:10 mdub

yup, DSL look good, also it would be nice to have some API for getting groups of option definitions or even get all options of a particular group

ares avatar Oct 07 '13 08:10 ares

This would be excellent for "global options" that are inherited to subcommands when subclassing.

kke avatar Mar 05 '19 07:03 kke