Closed markcocker closed 5 years ago
We only have a certain amount of influence over Imperative's error messages. There's an argument to be made for removing most of the command line validation from Zowe and instead validating the constraints within our code, that allows us to offer better error messages; but it would seem wrong to do that. Zowe/Imperative clearly intend for us to use their built in validation, Imperative gets to decide the relative priority of the different error messages that it issues.
In this instance the --help switch was omitted, so Imperative isn't expecting to have to issue any help text; you also omitted both the mandatory parameters and also the mandatory profile. Imperative decided to complain about the profile. It could have complained about the parameters too, or the parameters first, but it didn't; we could raise an issue against them requesting that they change this.
We could decide that the zOSMF profile isn't mandatory, and instead mark it as optional. But if we do that we either need to add all the zOSMF parameters to our externals (so that they can be set individually on the command line), or implement a hard requirement on the profile even though the generated command line help will clearly state that it's optional. Neither option is perfect.
Incidentally, the command line help in the OP isn't "extensive help about all the missing and optional parameters", it's only reporting the required parameters that are missing. If you want the full command line help then you'll have to set --help on that command too... it'll offer a lot more information.
If we consider the push bundle scenario then it's unlikely that we can do anything about this. Push requires three profiles: cics-deploy, SSH and zOSMF; we may add a 4th for CMCI. Many of those profiles have overlapping attributes, in some cases the content has to be different for each context, notably the --port parameter. If we make the profiles optional then we'll have a clash as only one --port can be set on the command line. We have to make the profiles mandatory, that way we can get the correct port for each context.
Many of the command line parameters for Zowe commands are not actually entered on the command line, they're instead derived from the profiles; Imperative has to read the profiles before it can know whether the mandatory parameters are set or not... so it really does have to issue error messages about missing required profiles before it issues them for missing parameters.
I don't think it's possible to do what this Issue is asking. We have to make the profiles mandatory, and Imperative has to issue errors about them before it can do detect any other errors.
The user can of course issue --help at any time to get the full command line help.
Based on the above, I'm happy to close this.
zowe zos-files list data-set
shows extensive help about all the missing and optional parameters:It would be useful if
zowe cics-deploy deploy bundle
showed similar help, rather than an error for a missing profile: