monotone-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [Monotone-devel] monotone with argp


From: Badai Aqrandista
Subject: Re: [Monotone-devel] monotone with argp
Date: Sat, 29 Jan 2005 01:51:45 +1000


From: Nathaniel Smith <address@hidden>

So what if we do it this way: there is a set of "global" options
(--debug, --help, etc.) that are compatible with every sub-command.
Each command also accepts other options.  These options are globally
unique and can occur anywhere on the command line, but if used with
the wrong sub-command will give some sort of error.
hmmm... i like your idea... it also has an advantage that argument parsing is only done once in one place (monotone.cc)... but then we need to display the option list ourselves, i don't know how to do it with argp... could anyone give a pointer?

So, in rough mockup (man, it's a lot easier doing mockups for command
line programs than for GUIs...):

$ monotone --help
Usage: monotone [OPTION...] command [ARGS...]

Global options:
  --debug               print debug log to stderr while running
  --dump=STRING         file to dump debugging log to, on failure
  --quiet               suppress log and progress messages
  --help                display help message
  --nostd               do not load standard lua hooks
--norc do not load ~/.monotonerc or MT/monotonerc lua files
  --rcfile=STRING       load extra rc file
  --key=STRING          set key for signatures
  --db=STRING           set name of database
  --branch=STRING       select branch cert for operation
  --version             print version number, then exit
  --full-version        print detailed version number, then exit
  --ticker=STRING       set ticker style (count|dot) [count]
Command-specific options:
  --revision=STRING     select revision id for operation (diff, cdiff)
  --message=STRING      set commit changelog message (commit)
<list of commands>
$ monotone commit --help
Usage: monotone [OPTION...] command [ARGS...]

Global options:
  <...>
Options for 'commit':
  --message=STRING      set commit changelog message
<description of commit command, as per now>
$ monotone commit --message=foo
<commits>
$ monotone --message=foo commit
<commits>
$ monotone --message=foo diff
monotone: misuse: 'diff' does not take option '--message'

Lots of things could be tweaked about this, but how does that sound as
a general approach?
sounds good... much simpler to implement and understand than CVS-like 2 level arguments, which i was planning to implement...

thanks
badai

_________________________________________________________________
On the road to retirement? Check out MSN Life Events for advice on how to get there! http://lifeevents.msn.com/category.aspx?cid=Retirement





reply via email to

[Prev in Thread] Current Thread [Next in Thread]