Skip to content

Commit b137039

Browse files
author
James Halliday
committed
usage and --help
1 parent 4fd4993 commit b137039

File tree

3 files changed

+28
-0
lines changed

3 files changed

+28
-0
lines changed

bin/cmd.js

+6
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,12 @@ var unpack = require('../');
88
var format = argv.format || 'pem';
99
var encoding = argv.e || argv.encoding || 'hex';
1010

11+
if (argv.h || argv.help) {
12+
return fs.createReadStream(__dirname + '/usage.txt')
13+
.pipe(process.stdout)
14+
;
15+
}
16+
1117
var file = process.argv[2] || '-';
1218
if (file === '-' && format === 'json') {
1319
var data = '';

bin/usage.txt

+9
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
usage: rsa-unpack {FILE|-} OPTIONS
2+
3+
OPTIONS:
4+
5+
--format format to expect FILE to be in.
6+
default: pem or json if FILE ends in .json
7+
8+
--encoding, -e encoding to use. default: hex
9+

readme.markdown

+13
Original file line numberDiff line numberDiff line change
@@ -47,6 +47,19 @@ The key can be a public or private key.
4747

4848
If the key is invalid, returns undefined.
4949

50+
# command-line usage
51+
52+
```
53+
usage: rsa-unpack {FILE|-} OPTIONS
54+
55+
OPTIONS:
56+
57+
--format format to expect FILE to be in.
58+
default: pem or json if FILE ends in .json
59+
60+
--encoding, -e encoding to use. default: hex
61+
```
62+
5063
# install
5164

5265
With [npm](https://npmjs.org) do:

0 commit comments

Comments
 (0)