Happened to hit below: oc run -aaaa Error: unknown shorthand flag: 'a' in -aaaa See 'oc run --help' for usage. Now `oc run -aaaa` does not reproduce bug 1748777 and bug 1748777#c17 is indeed verified, found below cmds still print usage when hitting errors, though the first output line is enough: oc run -lll Error: required flag(s) "image" not set Usage: oc run NAME --image=image [--env="key=value"] [--port=port] [--replicas=replicas] [--dry-run=bool] [--overrides=inline-json] [--command] -- [COMMAND] [args...] [flags] Examples: # Start a single instance of nginx. ... oc patch kubeapiserver/cluster Error: required flag(s) "patch" not set Usage: oc patch (-f FILENAME | TYPE NAME) -p PATCH [flags] Examples: ... oc version: openshift-clients-4.3.0-201911261917.git.1.133e54c.el7.x86_64
Sally can you check this, since you worked on https://bugzilla.redhat.com/show_bug.cgi?id=1748777 Moving this to 4.4, since it's a low priority item.
For the 'oc run -lll' example, the output is expected, because the '-i' or '--image=' flag is required to run the command. You passed 'oc run -lll' and that is actually a valid flag '-l=ll' or '--labels=ll', so you'll get the error for 'although a valid flag was passed, you did not give the required "image" flag. I think returning usage in this case makes sense. For 'oc patch' the output is also expected, that the '-p' or '--patch=' flag must be set. You passed 'oc patch type/name' but did not pass the "patch" flag like 'oc patch kubeapiserver/cluster -p blah'. Since a 'bad flag' was not given, you still get the usage menu. Again, I think returning usage makes sense here.
After discussing with team, we'll want to only return the suggestion to run help, instead of the full menu. I'll open a PR to this effect shortly.
upstream PR here: https://github.com/kubernetes/kubernetes/pull/86693
Confirmed with latest oc client, can't reproduce the issue now: oc version: 4.4.0-202001081744.git.1.1aae263.el7 [root@dhcp-140-138 ~]# oc run -lll Error: required flag(s) "image" not set [root@dhcp-140-138 ~]# oc run -aa Error: unknown shorthand flag: 'a' in -aa See 'oc run --help' for usage.
Since the problem described in this bug report should be resolved in a recent advisory, it has been closed with a resolution of ERRATA. For information on the advisory, and where to find the updated files, follow the link below. If the solution does not work for you, open a new bug report. https://access.redhat.com/errata/RHBA-2020:0581