You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
The last line contains if (program.peppers) which will be called if --peppers contains a value, but in this scenario, it always does get executed regardless of if I use the -p or --peppers flag. I would like to be able to provide a default value (like this) and only execute a result if a flag has been used, is that possible? I haven't found the correct way to achieve what I want from the documentation, but I was wondering if there was a more elegant solution than what I've done below:
In the commander docs, default values are specified like so:
(I added a default value of
foo
to the--peppers
option to illustrate my point)The last line contains
if (program.peppers)
which will be called if--peppers
contains a value, but in this scenario, it always does get executed regardless of if I use the-p
or--peppers
flag. I would like to be able to provide a default value (like this) and only execute a result if a flag has been used, is that possible? I haven't found the correct way to achieve what I want from the documentation, but I was wondering if there was a more elegant solution than what I've done below:This works but is there a way to achieve this using commander itself, like
if (program.peppers)
?The text was updated successfully, but these errors were encountered: