Permalink
Browse files

bin: Return with exit status `0` when calling with `-v`

Closes #28.
  • Loading branch information...
bahamas10 authored and mathiasbynens committed Feb 12, 2015
1 parent 8f6b34b commit c31d288b0a5b79d8797ee64d60b9a3b9f1aed33d
Showing with 5 additions and 7 deletions.
  1. +2 −2 bin/he
  2. +3 −5 man/he.1
4 bin/he
@@ -31,12 +31,12 @@
'\the --escape \\<img\\ src\\=\\\'x\\\'\\ onerror\\=\\"prompt\\(1\\)\\"\\>',
'\techo \'&copy; &#x1D306;\' | he --decode'
].join('\n'));
return process.exit(1);
return process.exit(option ? 0 : 1);
}

if (/^(?:-v|--version)$/.test(option)) {
log('v%s', he.version);
return process.exit(1);
return process.exit(0);
}

strings.forEach(function(string) {
@@ -1,4 +1,4 @@
.Dd July 27, 2013
.Dd April 5, 2016
.Dt he 1
.Sh NAME
.Nm he
@@ -56,12 +56,10 @@ utility exits with one of the following values:
.Bl -tag -width flag -compact
.It Li 0
.Nm
successfully encoded/decoded the input and printed the result.
did what it was instructed to do successfully; either it encoded/decoded the input and printed the result, or it printed the version or usage message.
.It Li 1
.Nm
wasn't instructed to encode/decode anything (for example, the
.Ar --help
flag was set); or, an error occurred.
encountered an error.
.El
.Sh EXAMPLES
.Bl -ohang -offset

0 comments on commit c31d288

Please sign in to comment.