Created
April 23, 2019 11:54
-
-
Save hxsf/80a51ded2817ba2cb8c36f55e9ec77d4 to your computer and use it in GitHub Desktop.
example for https://github.com/tj/commander.js/pull/611
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env node --harmony | |
var program = require('commander'); | |
program | |
.version('0.1.0') | |
.description('list packages installed') | |
.parse(process.argv); | |
console.log('[demo-list]', process.execArgv) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env node --harmony | |
var program = require('commander'); | |
program | |
.version('0.1.0') | |
.command('install [name]', 'install one or more packages') | |
.command('search [query]', 'search with optional query') | |
.command('list', 'list packages installed', {isDefault: true}) | |
.parse(process.argv); | |
console.log('[demo]', process.execArgv) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
{ | |
"name": "demo", | |
"version": "1.0.0", | |
"main": "index.js", | |
"license": "MIT", | |
"bin": { | |
"demo": "demo.js", | |
"demo-list": "demo-list.js" | |
}, | |
"dependencies": { | |
"commander": "^2.20.0" | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment