Skip to content

Instantly share code, notes, and snippets.

@mh-mobile
Created May 12, 2020 05:59
Show Gist options
  • Save mh-mobile/798336824d5b3c36b4838edfff68b2c0 to your computer and use it in GitHub Desktop.
Save mh-mobile/798336824d5b3c36b4838edfff68b2c0 to your computer and use it in GitHub Desktop.
require("yargs")
.scriptName("console")
.usage("$0 <cmd> [args]")
.command(
"hello [name]",
"console your name!",
(yargs) => {
yargs.positional("name", {
type: "string",
default: "mh-mobile",
describe: "the name to say hello to",
});
},
function (argv) {
console.log("hello", argv.name, "welcome to yargs!");
}
)
.help().argv;
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment