This is okay if you have one command. But for multiple commands, do yargs.argv at last after defining all commands.
const yargs = require('yargs');
const argv = yargs
.command({
command: 'add',
describe: 'Adding command',
handler: argv => {
console.log('Adding notes');
}
}).argv;
Example solution:
const yargs = require('yargs')
//add command
yargs.command({
command: 'add',
describe: 'Add a new note',
handler: ()=>{
console.log("Adding a new note")
}
})
//remove Command
yargs.command({
command: 'remove',
describe: "Remove a Note",
handler: ()=>{
console.log("removing note")
}
})
yargs.parse()