Red Hat Bugzilla – Bug 1278291
The OPTIONS place mismatch in different atomic-openshift-installer Usage
Last modified: 2016-07-03 20:46:07 EDT
Description of problem:
if we put OPTIONS after COMMAND, atomic-openshift-installer will pop up Error.
'atomic-openshift-installer --help' show OPTIONS should be prior to COMMAND, While 'atomic-openshift-installer upgrade --help' show OPTIONS should be at the back of COMMAND.
Version-Release number of selected component (if applicable):
Steps to Reproduce:
1.atomic-openshift-installer upgrade -c ansible.config
Error: no such option: -c
Usage: atomic-openshift-installer [OPTIONS] COMMAND [ARGS]...
3. atomic-openshift-installer upgrade --help
Usage: atomic-openshift-installer upgrade [OPTIONS]
The OPTIONS place mismatch in different help description.
The OPTIONS location should be accurate.
This is the behavior I would prefer as well, unfortunately we use the python Click library which explicitly does not agree with us: http://click.pocoo.org/5/commands/#passing-parameters
I attempted to pursue a decorator solution similar to the one in: https://github.com/mitsuhiko/click/issues/108
However this gets complicated as well. In the current form, all options then transfer to the subcommand and must be specified *after* install / uninstall / upgrade. They will not show up in "atomic-openshift-installer --help" either, but they would show up in "atomic-openshift-installer install --help".
I cannot specify them in both places without things getting very ugly.
So our options are (1) use what we have today, or (2) specify all cli args *after* the sub-command, which will break CLI commands shipping with 3.1.
Another other solution will probably require going to a different CLI library entirely.
The reasoning behind click's decision to only support (1) is pretty logical and clean, even if it's not as user friendly as we would like.
I'm going to assume we should keep it as it is today for now, please reopen this bug if QE feels strongly otherwise and I can use my implementation for (2) instead.