summaryrefslogtreecommitdiff
path: root/openstackclient/common/module.py
diff options
context:
space:
mode:
authorJenkins <jenkins@review.openstack.org>2017-02-27 03:47:11 +0000
committerGerrit Code Review <review@openstack.org>2017-02-27 03:47:11 +0000
commite5ee4b8ca3a1de9208ea0e05efec4162c4b9d6a4 (patch)
tree671e41ceb54d251fc731a2c00d9b4b6a338c404e /openstackclient/common/module.py
parentf63a9f402dc3761a1f7e358d92b7e1aa33098c7a (diff)
parent0898ebacb8d9c38ae36adaf593867a9b16a50504 (diff)
downloadpython-openstackclient-e5ee4b8ca3a1de9208ea0e05efec4162c4b9d6a4.tar.gz
Merge "Support list commands by group name keyword"
Diffstat (limited to 'openstackclient/common/module.py')
-rw-r--r--openstackclient/common/module.py14
1 files changed, 14 insertions, 0 deletions
diff --git a/openstackclient/common/module.py b/openstackclient/common/module.py
index ba911ecb..20497f21 100644
--- a/openstackclient/common/module.py
+++ b/openstackclient/common/module.py
@@ -29,12 +29,26 @@ class ListCommand(command.Lister):
auth_required = False
+ def get_parser(self, prog_name):
+ parser = super(ListCommand, self).get_parser(prog_name)
+ parser.add_argument(
+ '--group',
+ metavar='<group-keyword>',
+ help=_('Show commands filtered by a command group, for example: '
+ 'identity, volume, compute, image, network and '
+ 'other keywords'),
+ )
+ return parser
+
def take_action(self, parsed_args):
cm = self.app.command_manager
groups = cm.get_command_groups()
groups = sorted(groups)
columns = ('Command Group', 'Commands')
+ if parsed_args.group:
+ groups = (group for group in groups if parsed_args.group in group)
+
commands = []
for group in groups:
command_names = cm.get_command_names(group)