Command line interface design with basic options and subcommands

I am trying to develop a command line interface for a tool that I am writing. I toss between an interface like the Fabric fab tool and one of the svn command line tools.

fab usage message:

 Usage: fab [options] <command>[:arg1,arg2=val2,host=foo,hosts='h1;h2',...] ... 

svn usage message:

 usage: svn <subcommand> [options] [args] 

Note that svn also supports two options --version and --quiet (at least the one I use).

My questions:

  • Is fab cli (with multiple commands, each of which may have arguments) developed among command line tools? To me, the svn tool cli seems to be more common (not sure though).
  • Would it be easy to implement fab cli using plac (or argparse)?
  • If I decide to go with svn cli, can this be implemented using plac? I like plac, although I have not been able to figure out how to add parameters to the tool directly, not subcommands. It can be defined using argparse .

PS: The only reason fab cli contacts me is that you can complete several tasks in one step, however, the clarity of implementation is my main problem.

+4
source share
1 answer
  • subversion method is more standard.
  • Probably no.
  • You can cut the oil with a hand ax.

If you want to simplify the documentation and use, go along the SVN path. I can understand why the fab way seems attractive, this is logical for the programmer. But it is actually complicated and messed up for users.

Plac looks cool, but you need to install it. Your users too.

I like to follow a simple rule when it comes to software development: Keep it simple and standard, use overflow technology when you really need it . Retro compatibility should be achieved whenever possible.

However, you are simply fooling yourself and do not plan to distribute your work, then go ahead, flab and use flac;).

+4
source

All Articles