Skip to content
This repository has been archived by the owner on Nov 13, 2023. It is now read-only.

Single character options accessed w/ single dash (correct) but rendered in help w/ double-dash (incorrect) #638

Closed
robertblum-psi opened this issue Jul 24, 2021 · 1 comment · Fixed by #742
Assignees

Comments

@robertblum-psi
Copy link

robertblum-psi commented Jul 24, 2021

In most command line interfaces, single character options use a single dash. In Zowe, this seems to be true only when the single character option is defined as an alias.

Nevertheless, single character options defined using the name property are accessible with a single dash option on the command line but are rendered in the text and web help with double-dashes. That they can be accessed with a single dash is only true by a quirk of Zowe's programming. For an arbitrary sample option c, Zowe sends an argument array with a "c" property to provide the value to the program regardless of whether the user coded -c or --c on the command line. In any case, Zowe does not flag it as an error.

For example, in an options array on a ICommandDefinition I have:
{ name: "c", group: QUERY_OPTIONS, type: "string", description: "A list of comma separated, case-insensitive names of columns to include in...
Help renders this:

    --c  (string)
         A list of comma separated, case-insensitive names of columns to include in...

As pointed out above, Zowe doesn't break, but my Zowe program passes the command line not its internal array to consumer modules. Perhaps just as bad, the help generated by Zowe is is flat out wrong as far as the user is concerned. This application simulates an interface and uses options that reflect one character options in that interface. The -c option is the c parameter. I can't change that.

I think assuming double dash for a single character option name is a design oversight. I don't think it was intentional to assume all options will always have two dashes and that only an single character alias can have one dash. That's... I'm not sure what that is. I don't know if this becomes a breaking change, or not. If it is considered such, I'd vote for a NameIsSingleDash property being added. Otherwise, see my first line above.

PS C:\Users\Robert> zowe -V
6.32.0

@t1m0thyj
Copy link
Member

t1m0thyj commented Mar 4, 2022

This has been fixed in Imperative and should make it into the next Zowe CLI update (likely 6.38.0).

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants