climax icon indicating copy to clipboard operation
climax copied to clipboard

Formalize global/subcommand architecture.

Open apinstein opened this issue 14 years ago • 1 comments

Be opinionated about the following architecture:

cmd
   # global options
   -v -q
   # subcommand
   doSomething
   # subcommand options
   -foo=bar
   -bar=baz

Right now all commands are "equal" and this gets pretty confusing when one command might do something that should be mutually exclusive from another (hence the need for subcommands/subprograms).

Also the idea here is to be strict about where global options and subcommand options go, so that there's no confusion about how to specify things. This is slightly less flexible than allowing flags to be called before or after things, but it eliminates the hard-to-parse situations of flags after "arguments" and also detecting where "the rest of the arguments" are and how those are passed around.

apinstein avatar Mar 18 '11 22:03 apinstein

Starting to play around with ideas for this refactor on https://github.com/apinstein/climax/tree/subcommand-refactor

apinstein avatar May 01 '11 13:05 apinstein