January 2018
Beginner
658 pages
13h 10m
English
Now I don't have the titleOptions object created yet so the code would currently fail, but this is the general idea. We want to create the titleOptions object once and reference it in all the locations we use it, for add, read and remove command. I can take titleOptions, and add it for read as well as for add command, as shown here:
.command('add', 'Add a new note', { title: titleOptions, body: { describe: 'Body of note', demand: true, alias: 'b' }}).command('list', 'List all notes').command('read', 'Read a note', { title: titleOptions}).command('remove', 'Remove a note', {title: titleOptions})
Now, just previous the constant argv, I can create a constant called titleOptions, and I can set it ...