[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [Monotone-devel] "throw usage(); " or "N(); " for argument checking?
From: |
Thomas Keller |
Subject: |
Re: [Monotone-devel] "throw usage(); " or "N(); " for argument checking? |
Date: |
Sun, 04 Jan 2009 21:31:01 +0100 |
User-agent: |
Thunderbird 2.0.0.19 (Macintosh/20081209) |
Zack Weinberg schrieb:
>>>> A command that does "throw usage()" gives the same result as calling
>>>> "mtn help <command>", printing full usage info to stderr, where N()
>>>> results in "mtn: misuse: <message>" on stderr and will put a note in any
>>>> debug log.
>>> As long as the <message> is maintained in case of "throw usage()", I'm
>>> fine. I dislike tools which just throw the complete usage page at me and
>>> let me figure myself. Some hint on what's wrong certainly helps. And
>>> that hint should survive, IMO.
>> So I guess we should standardize on "throw usage()", but give usage a
>> what() and make the constructor take a message.
>
> I'm dubious about printing the full usage message on any command line
> mistake. Those are often long enough that they make the actual
> diagnostic scroll off the top of the terminal or at least be visually
> lost in a sea of chatter.
>
> What would be really good is if we could give customized usage advice
> based on the error, e.g. currently we have
>
> $ mtn ls
> mtn: misuse: no subcommand specified for 'ls'
>
> but 'mtn help ls' prints a 55-line message the relevant part of which
> is in the *middle.* It would be great if we could extract just the
> "subcommands of 'mtn ls'" part of that message and print it after the
> above diagnostic.
And while we're at it I'd like to add some --show-global-options option
to `mtn help' to prevent the additional 22 line output of global options
which should be commonly known to users. Or have some `mtn help options'
command which does exactly that.
Thomas
--
GPG-Key 0x160D1092 | address@hidden | http://thomaskeller.biz
Please note that according to the EU law on data retention, information
on every electronic information exchange might be retained for a period
of six months or longer: http://www.vorratsdatenspeicherung.de/?lang=en
signature.asc
Description: OpenPGP digital signature