-
Notifications
You must be signed in to change notification settings - Fork 1k
Closed
Labels
Description
I have a command with subcommands and one of them is default, see
const options = yargs
.command(['export'], 'Do export', yargs =>
yargs
.command(['csv', '*'], 'Export to CSV',
{
'value': { demandOption: true }
})
.command('html', 'Export to HTML', { 'value': { demandOption: true } })
.demandCommand(1)
)
.command(['import'], 'Do import', { 'value': { demandOption: true } })
.help().strict(true).demandCommand(1)
.parse();
Actual
When a user types wrong subcommand, then the help is wrong:
$ node index.js export foo
Export to CSV
Commands:
index.js export export Do export
index.js export import Do import
...
Expected
When I remove '*'
, i.e. the default command flag, from the csv
command, then the help is OK:
$ node index.js export foo
Do export
Commands:
index.js export csv Export to CSV
index.js export html Export to HTML
...