zowe-cli
zowe-cli copied to clipboard
ICommandOptionDefinition.implies option is not working as expected
Hi Team,
When we have used this implies option for two fields, as per the guide lines, it should throw error if either one of the option is specified without the other option. consider below example:
option1: restart, implies: restart-token, option2: restart-token, implies: restart
In the above example, when option1(restart) is specified in the command then we get the syntax error for not specifying option2(restart-token) this is correct, in same way if we specify option2(restart-token) without option1(restart) then there is no syntax error being thrown, this is incorrect as per the guide lines.
Please correct this issue as soon as possible.
Thanks Sai
One thing we found out is, the first option(restart) has default value set. Is this the reason behind not throwing error? Is it the expected behavior when default value is assigned, or do you think any documentation changes or behavior change is required?
Given that the first option has default value set, I believe this is expected behavior.
option1
doesn't have to be specified explicitly by a user on the command line - if option1
is defined anywhere in the order of precedence (in a default value, in a ZOWE_OPT_OPTION1 environment variable, etc), then the implies
will not throw an error.
Perhaps the Typedoc for the ICommandOptionDefinition.implies
property should be updated to make this clearer, since the wording "If this option is specified" may sound like it must be specified on the command line. Would "If this option is defined" be clearer?
yes, documentation update makes sense.
Given that the first option has default value set, I believe this is expected behavior.
option1
doesn't have to be specified explicitly by a user on the command line - ifoption1
is defined anywhere in the order of precedence (in a default value, in a ZOWE_OPT_OPTION1 environment variable, etc), then theimplies
will not throw an error.Perhaps the Typedoc for the
ICommandOptionDefinition.implies
property should be updated to make this clearer, since the wording "If this option is specified" may sound like it must be specified on the command line. Would "If this option is defined" be clearer?
hi @t1m0thyj , it definitely would. Does it makes sense to specify explicitly that the defaultValue
usage will be considered as defined
?
Thank you for raising this enhancement request. The community has 90 days to vote on it. If the enhancement receives at least 5 upvotes, it is added to our development backlog. If it receives fewer votes, the issue is closed.