From 1fc2480da87563437b1e7d69dbccadf09e803112 Mon Sep 17 00:00:00 2001 From: Seblu <sebastien.luttringer@smartjog.com> Date: Thu, 10 Feb 2011 14:03:04 +0100 Subject: [PATCH] delright can take a list of index or delete all with * --- cccli/command/right.py | 20 ++++++++++++++------ 1 file changed, 14 insertions(+), 6 deletions(-) diff --git a/cccli/command/right.py b/cccli/command/right.py index 005c3de..bc82b52 100644 --- a/cccli/command/right.py +++ b/cccli/command/right.py @@ -68,12 +68,20 @@ class Command_delright(Command): '''Delete account right''' def __call__(self, argv): - if len(argv) != 3: + if len(argv) < 3: raise cmdBadArgument() - try: - self.cli.rpc.call("delright", argv[1], int(argv[2])) - except RpcError as e: - raise cmdError("RPCError: %s"%str(e)) + l = argv[2:] + if "*" in l: + try: + self.cli.rpc.call("delright", argv[1], None) + except RpcError as e: + raise cmdError("RPCError: %s"%str(e)) + else: + for index in l: + try: + self.cli.rpc.call("delright", argv[1], int(index)) + except RpcError as e: + raise cmdError("RPCError: %s"%unicode(e)) def usage(self): - return "Usage: delright <account> <index>" + return "Usage: delright <tql> <index> ...\n\nindex * means all" -- GitLab