Skip to content

Instantly share code, notes, and snippets.

@ensonic
Last active August 29, 2015 14:20
Show Gist options
  • Save ensonic/60b8fc278da53b2dde45 to your computer and use it in GitHub Desktop.
Save ensonic/60b8fc278da53b2dde45 to your computer and use it in GitHub Desktop.
// Generated by CoffeeScript 1.9.1
(function() {
var program;
program = require('commander')
.option('--flag1 [true/false]', 'Flag1 (default = false)', false)
.option('--flag2 [true/false]', 'Flag2 (default = false)', (function(val) {
return val === "true";
}), false)
.parse(process.argv);
if (program.flag1) {
console.log("flag1(" + (typeof program.flag1) + ") is true");
} else {
console.log("flag1(" + (typeof program.flag1) + ") is false");
}
if (program.flag2) {
console.log("flag2(" + (typeof program.flag2) + ") is true");
} else {
console.log("flag2(" + (typeof program.flag2) + ") is false");
}
}).call(this);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment