I am trying to build a command-line interface with yargs, where one option takes an (optional!) argument:
const cli = yargs
.array('keyword')
.option('keyword', {
alias: 'k',
type: 'string',
describe: 'add additional keyword or clear previous keywords without an argument'
)
.argv;
In other words the usage program --keyword --keyword=this --keyword=that
is accepted.
How can I tell yargs to accept the option --keyword
with or without an option?