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
It would be nice if we could support subcommands, i.e.
./cli --root-arg a build --arg-for-build foo
./cli --root-arg b run --arg-for-run bar
One API possibility is to use the same Options but allow registering subcommands:
// Root optionletmut opts = Options::new();
opts.optflag("r","root-arg","dummy arg before subcommand");letmut sub_build = Options::new();
sub_build.opts.optopt("a","arg-for-build","build argument","TEXT");
opts.subcommand(sub_build,"b","build","start a build");letmut sub_run = Options::new();
sub_run.opts.optopt("a","arg-for-run","build argument","TEXT");
opts.subcommand(sub_run,"r","run","run the program");
Not sure what is best for Matches. The way that python does it is by treating the subcommand as a pseudoflag that you can name (via e.g. dest="subcommand") then merging all options. So the above example would need a call like opts.subcommand_arg_name("sub"), then a flag dump would look like:
Activity