开发者

Command-line interface design with base options and subcommands

I'm trying to develop a command line interface for a tool I'm writing. I'm tossing up betwee开发者_开发知识库n an interface similar to Fabric's fab tool and one like svn's command line tool.

fab's usage message:

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

svn's usage message:

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

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

My questions are:

  1. Is fab's cli (with multiple commands, each of which can have arguments) design common among command-line tools? To me, the svn tool's cli seems more commonly used (not sure though).
  2. Would it be straightforward implementing fab's cli using plac(or argparse)?
  3. If I do decide to go with svn's cli, can be this be implemented using plac? I like plac, though I haven't been able to figure out how to add options to the tool directly, instead of the subcommands. It can definitely be implemented using argparse.

P.S.: The only reason fab's cli appeals to me is that one can accomplish multiple tasks in one step, however ease of implementation is my main concern


  1. subversion's way is more standard.
  2. Probably not.
  3. You can cut butter with a hand axe.

If you want to simplify documentation and usage, go with SVN's way. I can see why fab's way seems appealing, it's logical for a programmer. But it's 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 engineering: Keep it simple and standard, use bleeding edge technologies when you really need it. Retro-compatibility should be achieved when possible.

However, you're just fooling around and don't plan on distributing your work, then go on, flab's way and using flac ;).

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜