diff options
author | Ryan Petrello <lists@ryanpetrello.com> | 2015-05-06 10:17:30 -0400 |
---|---|---|
committer | Ryan Petrello <lists@ryanpetrello.com> | 2015-05-06 10:17:56 -0400 |
commit | ca2e90a94031fdbba31bf4bda87b51a87e97eb7c (patch) | |
tree | fb7475ce51ddc4d8807900553d52eff682fe4f9e /cliff/command.py | |
parent | 79a8791e7fefdcbe62f264bf905ac09a1958e753 (diff) | |
download | cliff-master.tar.gz |
Diffstat (limited to 'cliff/command.py')
-rw-r--r-- | cliff/command.py | 50 |
1 files changed, 0 insertions, 50 deletions
diff --git a/cliff/command.py b/cliff/command.py deleted file mode 100644 index 116ae5c..0000000 --- a/cliff/command.py +++ /dev/null @@ -1,50 +0,0 @@ - -import abc -import argparse -import inspect - - -class Command(object): - """Base class for command plugins. - - :param app: Application instance invoking the command. - :paramtype app: cliff.app.App - """ - __metaclass__ = abc.ABCMeta - - def __init__(self, app, app_args): - self.app = app - self.app_args = app_args - return - - def get_description(self): - """Return the command description. - """ - return inspect.getdoc(self.__class__) or '' - - def get_parser(self, prog_name): - """Return an :class:`argparse.ArgumentParser`. - """ - parser = argparse.ArgumentParser( - description=self.get_description(), - prog=prog_name, - ) - return parser - - @abc.abstractmethod - def take_action(self, parsed_args): - """Override to do something useful. - """ - - def run(self, parsed_args): - """Invoked by the application when the command is run. - - Developers implementing commands should override - :meth:`take_action`. - - Developers creating new command base classes (such as - :class:`Lister` and :class:`ShowOne`) should override this - method to wrap :meth:`take_action`. - """ - self.take_action(parsed_args) - return 0 |