On Sun, Nov 10, 2002 at 09:02:34AM +0000, Mikhael Goikhman wrote:
> On 10 Nov 2002 12:45:07 +1100, Cameron Simpson wrote:
> > 
> > On 20:33 09 Nov 2002, Mikhael Goikhman <[EMAIL PROTECTED]> wrote:
> > | On 09 Nov 2002 18:24:18 +0100, Dominik Vogt wrote:

[snip]

> > So, what's I'm asking here is that:
> >     - whether you implement an actual -? option doesn't
> >       bug me, provided that _any_ bad option elicits the
> >       full usage string
> 
> It is good that you said GNU tells to print 2 lines only in this case,
> so I don't need to add more than several paragraphs of reasonings. :)
> 
> I am against dumping the whole usage (that is usually more than 24 lines
> since all my programs are very configurable) every time a user makes a
> typo. A user wants to see that "option -X is not supported", he does not
> need to go several screens up to determine whether this option means
> "show usage" or it is unrecognized or maybe needs an additional argument.
> The only correct way to handle a bad option is to print 2 lines:
> 
>   program: unrecognized option '-o'   (or: missing file argument after -o)
>   Run --help to get the list of all recognized options.

The proper solution - in my eyes - is to print the
"unknown option xyz" message *after* the usage message.  If the
verbose message is too long it should omit the lengthy
explanation.  And of course only the one letter options belong
into the usage line.  For example:

  $ foobar -z
  usage: foobar [-a] [-b] [-c] ... [-x] [-y]   <- one to two lines
  foobar: unknown option -z
  1 $ <-- return code 1

and

  $ foobar --help
  usage: foobar [-a] [-b] [-c] ... [-x] [-y]   <- many lines
    -a: explanation of option a
    -b: explanation of option b
    ...
    -x: explanation of option x
    -y: explanation of option y
  0 $ <-- return code 0

I think this is a good solution in between.  I have committed a
patch that cleans up the chaos in the fvwm executable and the man
page and uses this style.  Take a look and tell me what you think.
Try "fvwm -x" and "fvwm --help".

> A user knows what he does if he specified -o option, he wants the result
> now. Or to see the diagnostic error line to know what he did wrong. He is
> not interested in anything forced like copyright/license/--version/--help.
> (In fact, IMHO the only place for copyrights is the man page and sources.)
> 
> And I would prefer these two lines to be dumped to stderr like gcc does it
> and not stdout like gnome-terminal does it. Because stdout should contain
> the result of the program's run designed to be parsable/piped, an error
> option should not damage the expectations of the following piped program.
> It is ok for me that --help is dumped to stdout like GNU says, because in
> this case the usage screens are the output of the program, i.e. parsable.
> 
> >     - if you do implement -?, I request that it definitely
> >       emits a usage message
> 
> I will add the -? alias to all my scripts for everyone to be happy. :)
> It's a matter of adding 2 characters "|?" to a perl script or a module.
 
> In any case, I would not blindly follow all GNU "standards", only the
> reasonable ones. Even GNU projects do not follow all of them.

Neither would I.  But standardizing option names and usage
messages is one of the useful things.

Bye

Dominik ^_^  ^_^

 --
Dominik Vogt, [EMAIL PROTECTED]
Reply-To: [EMAIL PROTECTED]
--
Visit the official FVWM web page at <URL:http://www.fvwm.org/>.
To unsubscribe from the list, send "unsubscribe fvwm-workers" in the
body of a message to [EMAIL PROTECTED]
To report problems, send mail to [EMAIL PROTECTED]

Reply via email to