Commits

Anonymous committed 4b8a353

Global things

Comments (0)

Files changed (1)

 {{{
 #!python
 
-#!/usr/bin/env python
-# -*- coding: utf-8 -*-
-
-"""
-"""
-
-import sys 
-from optparse import make_option
-
-from adama import sir_yes_sir
-
-global_options = (
-    make_option('-o', '--option', action='store', dest='option'),
-    # options for command come here
-    # use make_option
-    # see http://docs.python.org/library/optparse.html#populating-the-parser
-)
-
-if __name__ == '__main__':
-    sys.exit(sir_yes_sir(module='pytodo', doc=__doc__, options=global_options, version=''))
-
+#!/usr/bin/env python
+# -*- coding: utf-8 -*-
+
+"""
+"""
+
+import sys
+from optparse import make_option
+
+from adama import sir_yes_sir
+
+global_options = (
+    make_option('-o', '--option', action='store', type='string', dest='option',
+        help='i am the help for the option -o'),
+    # options for command come here
+    # use make_option
+    # see http://docs.python.org/library/optparse.html#populating-the-parser
+)
+
+if __name__ == '__main__':
+    sys.exit(sir_yes_sir(module='todolister', doc=__doc__, options=global_options, version=''))
 }}}
 \\
-So when you type **//pytodo help add//**:
+So when you type **//pytodo help add//**, you will see this help:
 \\
 {{{
 !#bash
 
 $> pytodo help add
-}}}
+Usage: pytodo order [options] [args]
+
+Options:
+  -o OPTION, --option=OPTION
+                        i am the help for the option -o
+  -h, --help            show this help message and exit
+
+Type 'pytodo help <order>' for help on a specific order.
+
+Available orders:
+  add	help for the order (ex: __doc__)
+
 }}}
 ==== Global help ====
-
+You can easily add a brief text help between the usage and the options. Simply add a docstring to the top of your command
+\\
+{{{
+#!python
+
+#!/usr/bin/env python
+# -*- coding: utf-8 -*-
+
+"""This command helps you to add and close todo
+"""
+
+...
+}}}
+\\
+Now you can see that the help is displayed for the pytodo command
+\\
+{{{
+#!bash
+$> pytodo help
+Usage: pytodo order [options] [args]
+
+This command helps you to add and close todo
+
+Options:
+  -o OPTION, --option=OPTION
+                        describes the help for the option
+  -h, --help            show this help message and exit
+
+Type 'pytodo help <order>' for help on a specific order.
+
+Available orders:
+  add	help for the order (ex: __doc__)
+
+}}}
+\\
 ==== Global version ====
+To enable the --version option, you need to specify a way to pass the version of your application to the command.
+
+{{{
+#!bash
+$> pytodo --version
+pytodo 0.4.3
+}}}