summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorPatrick Totzke <patricktotzke@gmail.com>2011-12-10 12:50:45 +0000
committerPatrick Totzke <patricktotzke@gmail.com>2011-12-10 12:50:45 +0000
commit92a7b0c4ee05f86f3ecf2901747eadc1f0b85103 (patch)
tree613eda2fbb5eb3b8a7b08c0103fb6417deff6ded
parentd6d915b609cbb09d584548d95b24a7e740288be8 (diff)
read commands help from docstrings if undefined
if the help parameter to the registercommand decorator is unset, take the classes docstring. this way one doesn't have to duplicate it for simple commands
-rw-r--r--alot/commands/__init__.py3
1 files changed, 2 insertions, 1 deletions
diff --git a/alot/commands/__init__.py b/alot/commands/__init__.py
index d5ea60bc..b7024507 100644
--- a/alot/commands/__init__.py
+++ b/alot/commands/__init__.py
@@ -75,7 +75,8 @@ class registerCommand(object):
self.arguments = arguments
def __call__(self, klass):
- argparser = CommandArgumentParser(description=self.help,
+ helpstring = self.help or klass.__doc__
+ argparser = CommandArgumentParser(description=helpstring,
usage=self.usage,
prog=self.name, add_help=False)
for args, kwargs in self.arguments: