trevorld / r-argparse

command-line optional and positional argument parser
GNU General Public License v2.0
103 stars 11 forks source link

Subcommand support #14

Closed arendsee closed 5 years ago

arendsee commented 7 years ago

It would be neat if argparse supported subcommands.

For example,

parser <- ArgumentParser()
subparser <- parser$add_subparsers()
foo_parser <- subparser$add_parser('foo', help="foo subcommand")
bar_parser <- subparser$add_parser('bar', help="bar subcommand")
foo_parser$add_argument('x', help="foo's x")
bar_parser$add_argument('x', help="bar's x")

The subcommand structure is really powerful for large command line programs (e.g. git) and is pretty easy to use in python's argparse.

trevorld commented 7 years ago

Subcommand support would be pretty cool however seems kind of complicated to implement. Adding this will be a low priority for me.

trevorld commented 5 years ago

Should do #25 before this.