Skip to content
Snippets Groups Projects
Commit 1f51db71 authored by Seblu's avatar Seblu
Browse files

fix some usage displaying

parent e3cd9651
No related branches found
No related tags found
No related merge requests found
......@@ -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:
......
......@@ -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:
......
......@@ -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()
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment