January 2018
Beginner
658 pages
13h 10m
English
Now before we get into the options object, let's add one more call right after command. We're going to call .help, which is a method, so we're going to call it as a function, and we don't need to pass in any arguments:
const argv = yargs .command('add', 'Add a new note', { }) .help() .argv;
When we add on this help call, it sets up yargs to return some really useful information when someone runs the program. For example, I can run the node app.js command with the help flag. The help flag is added because we called that help method, and when I run the program, you can see all of the options we have available:
node app.js --help
As shown in the preceding output, we have one command, add Add a new note, and a help ...
Read now
Unlock full access