zowe-cli icon indicating copy to clipboard operation
zowe-cli copied to clipboard

ICommandOptionDefinition.implies option is not working as expected

Open charan1487 opened this issue 3 years ago • 5 comments

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

charan1487 avatar Nov 26 '21 13:11 charan1487

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?

charan1487 avatar Dec 02 '21 08:12 charan1487

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?

t1m0thyj avatar Mar 03 '22 14:03 t1m0thyj

yes, documentation update makes sense.

charan1487 avatar Mar 07 '22 14:03 charan1487

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?

hi @t1m0thyj , it definitely would. Does it makes sense to specify explicitly that the defaultValue usage will be considered as defined ?

sosadchuk avatar Mar 08 '22 10:03 sosadchuk

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.

github-actions[bot] avatar Nov 17 '23 19:11 github-actions[bot]