Opened 13 years ago

Closed 12 years ago

#637 closed enhancement (fixed)

Always detect `--help` option

Reported by: Peter Owned by: Peter
Priority: major Milestone: yat 0.8
Component: utility Version: trunk
Keywords: Cc:

Description

From http://dev.thep.lu.se/svndigest/ticket/471

First a few example command lines. --anchor_format does not exist, I simply made a guess.

svndigest --anchor_format=null

svndigest --anchor_format=null --help

svndigest --help --anchor_format=null

Obviously the first line above fails but so do the second line. The third line will go through and help information is displayed. I think the second line should also be accepted and help information should be displayed. If I get an invalid argument message I usually add --help to my command line without change anything else. I read the help and correct my mistake.

Change option parsing to accept --help irrespective order and invalid arguments.

Change History (7)

comment:1 Changed 13 years ago by Peter

This GNU Automake thread discusses this and they seem to think it is a bad idea because it just makes the code more complicated.

comment:2 Changed 13 years ago by Peter

comment:3 Changed 13 years ago by Jari Häkkinen

Is the idea here to wait for a decision in bug-standards and the go for their conclusion?

comment:4 in reply to:  3 Changed 13 years ago by Peter

Replying to jari:

Is the idea here to wait for a decision in bug-standards and the go for their conclusion?

Not really. I figured the different opinions were relevant for this ticket. If there were a decision that this behaviour is required then I would feel more motivated to get this done before next minor release. I don't think there will be a decision, but GCS is unspecific here.

comment:5 Changed 12 years ago by Peter

Milestone: yat 0.x+yat 0.8
Owner: changed from Jari Häkkinen to Peter
Status: newassigned

comment:6 Changed 12 years ago by Peter

(In [2456]) adding test for ticket refs #637.

comment:7 Changed 12 years ago by Peter

Resolution: fixed
Status: assignedclosed

(In [2458]) Always detect '--help' (fixes #637). Change CommandLine::parse so the entire commandline is parsed. When an error is detected it is stored and _after_ commandline has been parsed, the exception is thrown. New tests 'help.test' and 'help_test.sh'; latter calls former with '--help' and invalid arguments to check that '--help' is always detected. Added a function 'run' in 'common_defs.sh.in'. Remove test case from commandline.cc because OptionHelp? calls exit and the remaining tests (in commandline) were not run.

Note: See TracTickets for help on using tickets.