summaryrefslogtreecommitdiff
path: root/cliff/command.py
diff options
context:
space:
mode:
authorDoug Hellmann <doug.hellmann@gmail.com>2012-08-02 10:05:36 -0700
committerDoug Hellmann <doug.hellmann@gmail.com>2012-08-02 10:05:36 -0700
commit22d32f60d3481b89a366fcf3416992618cb5a9e3 (patch)
tree1dce3d965f14f8b9dc27e5ba9b56e2b084014638 /cliff/command.py
parentce0aa4609c76e60ea580afcfee1f8103931b0fee (diff)
parent8896e385ebc963145677303bf8d6eb134dcf582c (diff)
downloadcliff-tablib-22d32f60d3481b89a366fcf3416992618cb5a9e3.tar.gz
Merge pull request #1 from dhellmann/feature/package-tablib-support1.0
Start cliff-tablib repo
Diffstat (limited to 'cliff/command.py')
-rw-r--r--cliff/command.py50
1 files changed, 0 insertions, 50 deletions
diff --git a/cliff/command.py b/cliff/command.py
deleted file mode 100644
index 1661313..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