adrianaisemberg/CLAP

Return 1

hickford opened this issue · 7 comments

I like how CLAP applications given a bad command give back a useful message. They ought to fail in the Unix sense, ie. give a non-zero return code

$ git party ; echo  $?
git: 'party' is not a git command. See 'git --help'.
1

Whereas with a CLAP app:

 Verb 'party' was not found
 0

Interesting.
I'll design something and implement ASAP.

Thanks!

Adrian Aisemberg
vercue.com http://www.vercue.com
sharpregion.com http://www.sharpregion.com

On Thu, Mar 22, 2012 at 11:51 AM, Matt Hickford <
reply@reply.github.com

wrote:

CLAP applications ought to use return codes to mimic Unix commands. For
comparison

$ git party ; echo $?
git: 'party' is not a git command. See 'git --help'.
1

Whereas with a CLAP app

Verb 'party' was not found
0

$ git status ; echo $?
fatal: Not a git repository (or any of the parent directories): .git
128


Reply to this email directly or view it on GitHub:
#12

Another thought: what happens if my verb method returns an int?

Fixed in 3.9.
Returns 1 or 0, according to whether an error occurred or not.

Thanks Adrian

All verbs are void by design, however, I'll consider changing it to allow returning values, although it will be a conflict to returning an int according to success/failure.

Void verbs is sensible. If I want to exit with a specific code I will use Environment.Exit

Cheers!