January 2018
Beginner
658 pages
13h 10m
English
In the case of title, we would add the title on the left-hand side, and we would put our options object on the right-hand side. Inside the title, we're going to configure three properties describe, demand, and alias:
The describe property will be set equal to a string, and this is going to describe what is supposed to be passed in for the title. In this case, we can just use Title of note:
const argv = yargs .command('add', 'Add a new note', { title: { describe: 'Title of note' } }) .help() .argv;
Next we configure demand. It is going to tell yarg whether or not this argument is required. demand is false by default, we'll set it to true:
const argv = yargs .command('add', 'Add a new note', { title: { describe: 'Title of note', ...