-
-
Notifications
You must be signed in to change notification settings - Fork 1.7k
Closed
Labels
Description
Hi there, twice I've accidentally written a line of code like this:
.addOption(new Option(
'--port <number>',
'Which port to run the server on for sync mode'
).default(undefined).implies('sync'))
Ie, I want the --port
option to imply the boolean flag sync
. However, sync
is expecting an object of implied key-value pairs. However, as is, this fails silently and converts the string/array 'sync'
into an object, and merges it with the rest of the options:
{
'0': 's',
'1': 'y',
'2': 'n',
'3': 'c',
editor: true,
logging: true,
open: true,
backup: true,
sync: true,
port: '4004'
}
I'm proposing a check that the argument to implies
is an object and not a string, and if it is a string, error. (Or, interpret the string as the name of a boolean option that the programmer is asserting should be true.)
Thanks!