Created
November 12, 2015 01:05
-
-
Save Teino1978-Corp/b3dfd444833e89ae1ed5 to your computer and use it in GitHub Desktop.
commander.js command with actions
This file contains hidden or 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
var program = require('commander'); | |
program | |
.command('create [name]') | |
.description('create environment') | |
.action(function() { | |
console.log(1); | |
}); | |
program | |
.command('use [name]') | |
.description('use environment') | |
.action(function() { | |
console.log(2); | |
}); | |
program.parse(process.argv); | |
// | |
// $ node cli.js create test | |
// 1 | |
// $ node cli.js use test | |
// 2 |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment