Hello world CLI Package which uses Node JS
I built this to learn how to make CLI Apps with Node JS
Watch this video to learn more
#!/usr/bin/env node
console.log("hello, how are you?");
const argv = process.argv;
const [, , ...args] = process.argv;
if (args.length === 0) {
process.exit(1);
} else {
console.log(args);
}
Command to run the CLI Script or App = hi Ouptut =
hello, how are you?
Command with Arguments = hi t e s t Ouptut =
hello, how are you?
[ 't', 'e', 's', 't' ]
Command with Arguments = hi test Ouptut =
hello, how are you?
[ 'test' ]