Samus CTO (OpenERP) has proposed merging 
lp:~openerp-dev/openerp-command/trunk-better_help-cto into lp:openerp-command.

Requested reviews:
  OpenERP Core Team (openerp)

For more details, see:
https://code.launchpad.net/~openerp-dev/openerp-command/trunk-better_help-cto/+merge/132860

Try to get a nicer help message for the standalone command --help
-- 
https://code.launchpad.net/~openerp-dev/openerp-command/trunk-better_help-cto/+merge/132860
Your team OpenERP R&D Team is subscribed to branch 
lp:~openerp-dev/openerp-command/trunk-better_help-cto.
=== modified file 'openerpcommand/__init__.py'
--- openerpcommand/__init__.py	2012-08-23 09:25:05 +0000
+++ openerpcommand/__init__.py	2012-11-05 10:32:56 +0000
@@ -1,4 +1,5 @@
 import argparse
+import textwrap
 
 from .call import Call
 from .client import Open, Show, ConsumeNothing, ConsumeMemory, LeakMemory, ConsumeCPU
@@ -17,11 +18,28 @@
 from . import uninstall
 from . import update
 
+command_list = (conf, drop, initialize, model, module, read, run_tests, scaffold, uninstall, update,)
+
 def main_parser():
-    parser = argparse.ArgumentParser()
-    subparsers = parser.add_subparsers()
+    parser = argparse.ArgumentParser(
+        usage=argparse.SUPPRESS,
+        description=textwrap.fill("""OpenERP Command provides a set of command-line tools around the OpenERP framework: openobject-server. All the tools are sub-commands of a single oe executable."""),
+        epilog="""Use <command> --help to get information about the command.""",
+        formatter_class=argparse.RawDescriptionHelpFormatter,
+    )
+    description = ""
+    for x in command_list:
+        description += x.__name__[len(__package__)+1:] + ":\n" + \
+                       textwrap.fill(str(x.__doc__).strip(),
+                                     subsequent_indent='  ',
+                                     initial_indent='  ') + "\n\n"
+    subparsers = parser.add_subparsers(
+        title="Available commands",
+        help=argparse.SUPPRESS,
+        description=description.strip(),
+    )
     # Server-side commands.
-    for x in (conf, drop, initialize, model, module, read, run_tests, scaffold, uninstall, update,):
+    for x in command_list:
         x.add_parser(subparsers)
     # Client-side commands. TODO one per .py file.
     for x in (Call, Open, Show, ConsumeNothing, ConsumeMemory, LeakMemory, ConsumeCPU,

_______________________________________________
Mailing list: https://launchpad.net/~openerp-dev-gtk
Post to     : [email protected]
Unsubscribe : https://launchpad.net/~openerp-dev-gtk
More help   : https://help.launchpad.net/ListHelp

Reply via email to