Commits

Arnaud Grausem  committed f92a5d4

  • Participants
  • Parent commits 6d1bfc1

Comments (0)

Files changed (1)

 Welcome to the Adama documentation ! Adama is a light and simple command line tool and API to create **commands** for your Python applications and also subcommands named **orders**
 
 
-=== Commands ===
+=== Creating commands ===
 
 Imagine a little library that handles todo list. You named it pytodo and want a command that will handle the **add** order and the **done** order. Adama can brievely makes it work !
 \\
 \\
 Ok, you didn't create order yet. Next you want to see how to create them for your pytodo command
 
-=== Orders ===
+=== Creating orders ===
 
 Adama comes with a create_order order that takes the module and the name of the order you want to create. This will add a new package named "orders" in the root path of your pytodo project.  
 
 $> ls /path/to/pytodo/orders
 add.py  __init__.py
 }}}
+\\
+
+=== Customizations on command ===
+
+You can easily customize your command as :
+  * creating global options for all your orders
+  * displaying a global help for your command
+  * defining the version of your command (command --version)
+
+==== Global options ====
+When several of your orders share the same options, it a good idea to make them global to your command. Adama can do that. You must define a global options list in your pytodo command file :
+
+{{{
+#!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=''))
+
+}}}
+\\
+So when you type **//pytodo help add//**:
+\\
+{{{
+!#bash
+
+$> pytodo help add
+}}}
+}}}
+==== Global help ====
+
+==== Global version ====