From d32185cb34495b0af4b4e646a93aedf4d7f86d25 Mon Sep 17 00:00:00 2001 From: Dean Troyer Date: Wed, 27 Aug 2014 23:26:42 -0500 Subject: Add 'command list' command * Add method to CommandManager to retrieve command names by group * Add ListCommands To list command groups loaded by cliff Change-Id: I37fe2471aa2fafa8aa223159452d52b1981021d6 --- openstackclient/common/module.py | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) (limited to 'openstackclient/common/module.py') diff --git a/openstackclient/common/module.py b/openstackclient/common/module.py index 7f9c52db..356cdca3 100644 --- a/openstackclient/common/module.py +++ b/openstackclient/common/module.py @@ -19,9 +19,25 @@ import logging import six import sys +from cliff import lister from cliff import show +class ListCommand(lister.Lister): + """List recognized commands by group""" + + auth_required = False + log = logging.getLogger(__name__ + '.ListCommand') + + def take_action(self, parsed_args): + self.log.debug('take_action(%s)', parsed_args) + cm = self.app.command_manager + groups = cm.get_command_groups() + + columns = ('Command Group', 'Commands') + return (columns, ((c, cm.get_command_names(group=c)) for c in groups)) + + class ListModule(show.ShowOne): """List module versions""" -- cgit v1.2.1