Subcommand '--version' parameters are not supported
Affects | Status | Importance | Assigned to | Milestone | |
---|---|---|---|---|---|
cliff |
New
|
Undecided
|
Unassigned |
Bug Description
I'm reworking some code to use cliff. I've modified the sample app to add the following file:
$ cat demoapp/
from cliff.command import Command
class Sync(Command):
"""Sync the database up to the most recent version."""
def get_parser(self, prog_name):
parser = super(Sync, self).get_
return parser
def take_action(self, parsed_args):
version = parsed_args.version
$ git diff demoapp/setup.py
diff --git a/demoapp/setup.py b/demoapp/setup.py
index dd8695d..7562a7f 100644
--- a/demoapp/setup.py
+++ b/demoapp/setup.py
@@ -60,6 +60,7 @@ setup(
+ 'api-db_sync = cliffdemo.
],
},
However, when I run this command it appears the '--version' parameter is parsed by the top level parser instead of being propagated down like the '--help' parser is.
$ demoapp api-db sync --help
usage: nova-manage api-db sync [-h] [--version [<version>]]
Sync the database up to the most recent version.
optional arguments:
-h, --help show this help message and exit
--version [<version>]
$ demoapp api-db sync --version 2
demoapp 0.1
This seems like a bug, to me: the '--version' parameter makes no sense in this location in a command and does not need to be reserved.
Updated to reflect impact to demoapp.