summaryrefslogtreecommitdiff
path: root/openstackclient/common/module.py
diff options
context:
space:
mode:
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)