Skip to content

Instantly share code, notes, and snippets.

@andrewjmead
Created May 17, 2016 13:23
Show Gist options
  • Save andrewjmead/0cf7c0f7bc484d32c54b0e559941e3c5 to your computer and use it in GitHub Desktop.
Save andrewjmead/0cf7c0f7bc484d32c54b0e559941e3c5 to your computer and use it in GitHub Desktop.
Yargs 4.x.x.
var argv = require('yargs')
.command('Hello', 'Greets the User', function(yargs){
return yargs.options({
name: {
demand: true
}
});
})
.argv;
var command = argv._[0];
if (command === 'hello' && typeof argv.name !== 'undefined'){
console.log('Hello '+ argv.name +' '+ argv.lastName);
}// end if
else if (command === 'hello'){
console.log('hello world!');
}// end else
@ahmed-hadaka
Copy link

Your website doesn't work

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment