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: Nathaniel Smith
Subject: Re: [Monotone-devel] monotone with argp
Date: Thu, 27 Jan 2005 13:24:10 -0800
User-agent: Mutt/1.5.6+20040907i

On Thu, Jan 27, 2005 at 09:04:36AM -0700, Derek Scherger wrote:
> 
> On Thu, 27 Jan 2005, Badai Aqrandista wrote:
> >i am planning to add sub command argument to monotone with argp... my 
> >first target will be --message because it is specific only to 'commit' 
> >command... any thoughts?
> 
> I think that --message might also reasonably apply to the comment command 
> and I'm not sure what to do with that. It seems like we perhaps have a set 
> of available options, some subset of which applies to each command. I'm 
> sure that some options really will be specific to exactly one command 
> though (-ubw type options for diff for example).

I was thinking about this some the other day... CVS gets flack,
somewhat justifiably, for its confusing two-tier command line, where
the same option can mean completely different things depending on
whether it goes before or after the sub-command.  So we'd been
originally trying to avoid having sub-command options like that in
Monotone.  On the other hand, we do seem to really need some sort of
sub-command options...

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.

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?

-- Nathaniel

-- 
In mathematics, it's not enough to read the words
you have to hear the music




reply via email to

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