1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
| #!/usr/bin/env node
|
| var cli = require('cli');
|
| //The second (optional) argument of cli.parse() is a command list
| //Type `./command.js --help` for usage info
|
| //cli enables auto-completion of commands (similiar to npm), e.g. all of
| //the following are equivalent and result in "Command is: install":
| // $ ./command.js install
| // $ ./command.js inst
| // $ ./command.js i
|
| cli.parse(null, ['install', 'test', 'edit', 'remove', 'uninstall', 'ls']);
|
| console.log('Command is: ' + cli.command);
|
|