From 1f51db71e6167110015ad371de7ab4059877144d Mon Sep 17 00:00:00 2001
From: Seblu <sebastien.luttringer@smartjog.com>
Date: Fri, 4 Feb 2011 20:28:09 +0100
Subject: [PATCH] fix some usage displaying

---
 cccli/cli.py           |  2 +-
 cccli/command/right.py | 11 +++++++----
 cccli/command/shell.py |  7 +++++--
 3 files changed, 13 insertions(+), 7 deletions(-)

diff --git a/cccli/cli.py b/cccli/cli.py
index f97cf86..6a579b4 100644
--- a/cccli/cli.py
+++ b/cccli/cli.py
@@ -149,7 +149,7 @@ class Cli(object):
                 self.printer.error("Bad argument.")
             usage = self.commands.usage(argv[0])
             if usage != "":
-                self.printer.out("usage: %s."%usage)
+                self.printer.out(usage)
         except cmdBadName:
             self.printer.error("No command: %s."%argv[0])
         except cmdWarning as e:
diff --git a/cccli/command/right.py b/cccli/command/right.py
index 65c2a21..cf99069 100644
--- a/cccli/command/right.py
+++ b/cccli/command/right.py
@@ -13,7 +13,7 @@ from cccli.command.command import Command
 from optparse import OptionParser
 
 class Command_rights(Command):
-    '''List account rights (current by default)'''
+    '''List account rights'''
 
     def __call__(self, argv):
         # Parse argline
@@ -49,7 +49,7 @@ class Command_rights(Command):
 
 
 class Command_addright(Command):
-    '''Add/edit a right'''
+    '''Add or edit account right'''
 
     def __call__(self, argv):
         if len(argv) != 5:
@@ -60,11 +60,14 @@ class Command_addright(Command):
             raise cmdError("RPCError: %s"%str(e))
 
     def usage(self):
-        return "Usage: addright <tql> <right tql> <method> <target>"
+        return '''Usage: addright <account tql> <right tql> <method> <target>
+
+<method> is the name of the rpc command to allow
+<target> can be allow or deny'''
 
 
 class Command_delright(Command):
-    '''Delete a right'''
+    '''Delete account right'''
 
     def __call__(self, argv):
         if len(argv) != 3:
diff --git a/cccli/command/shell.py b/cccli/command/shell.py
index 5a78f54..b80d7f0 100644
--- a/cccli/command/shell.py
+++ b/cccli/command/shell.py
@@ -14,6 +14,7 @@ class Command_quit(Command):
     def __call__(self, argv):
         raise SystemExit()
 
+
 class Command_version(Command):
     '''Print cli version'''
     def __call__(self, argv):
@@ -52,8 +53,10 @@ class Command_help(Command):
          elif len(argv) == 2:
              if argv[1] not in self.cli.commands:
                  raise cmdBadArgument(argv[1])
-             self.printer.out(self.cli.commands.help(argv[1]))
-             self.printer.out(self.cli.commands.usage(argv[1]))
+             c = self.cli.commands
+             for u in (c.help(argv[1]), c.usage(argv[1])):
+                 if u != "":
+                     self.printer.out(u)
          else:
              raise cmdBadArgument()
 
-- 
GitLab