1
0
mirror of https://github.com/onkelbeh/cheatsheets.git synced 2026-08-15 21:44:51 +02:00
This commit is contained in:
Rico Sta. Cruz
2014-08-12 12:03:16 +08:00
parent c03d0b74e3
commit bd4ab84883
6 changed files with 73 additions and 1 deletions

View File

@@ -18,6 +18,31 @@ args == {
}
```
```js
if (args.help) {
var cmd = require('path').basename(process.argv[1]);
console.log(require('fs').readFileSync(__dirname+'/../help.txt','utf-8').replace(/\$0/g, cmd));
].join('\n'));
process.exit();
}
if (args.version) {
console.log(require('../package.json').version);
process.exit();
}
```
### Help.txt
```
Usage:
$0 FILES [options]
Options:
-h, --help print usage information
-V, --version show version info and exit
```
### Reference
* https://www.npmjs.org/package/minimist