Commits

Arnaud Grausem  committed 163b0e8

Documentation of command script becomes the description in main help of command

  • Participants
  • Parent commits 7e606d6

Comments (0)

Files changed (3)

 #!/usr/bin/env python
 # -*- coding: utf-8 -*-
 
+"""Adama main command to create commands and orders for your applications
+"""
+
 import sys
 from adama import sir_yes_sir
 
+
 if __name__ == '__main__':
-	sys.exit(sir_yes_sir())
+	sys.exit(sir_yes_sir(doc=__doc__))

File src/adama/__init__.py

 from .commandment import Commander, OrderError
 
 
-def sir_yes_sir(module='', argv=None):
+def sir_yes_sir(module='', doc='', argv=None):
     """
     """
     argv = argv if argv else sys.argv[:]
     command = os.path.basename(argv[0])
     module = module if module else command
-    commander = Commander(command, module)
+    commander = Commander(command, module, doc)
 
     no_arg = len(argv) == 1
     needs_help = not no_arg and argv[1] == 'help'

File src/adama/commandment.py

 
     __orders = {}
 
-    def __init__(self, command, module):
+    def __init__(self, command, module, doc):
         super(Commander, self).__init__(command, module)
+        self.doc = doc if doc else __doc__
 
     @property
     def orders(self):
     @property
     def decrypter(self):
         decrypter = super(Commander, self).decrypter
+        decrypter.description = self.doc
         epilog = """
 Type '{0} help <order>' for help on a specific order.