Skip to content
Snippets Groups Projects
Commit 9c65957b authored by Seblu's avatar Seblu
Browse files

rigths use OptionCommand

parent 31dd6b06
No related branches found
No related tags found
No related merge requests found
...@@ -8,20 +8,21 @@ CloudControl right releated commands ...@@ -8,20 +8,21 @@ CloudControl right releated commands
from cccli.exception import * from cccli.exception import *
from sjrpc.core.exceptions import * from sjrpc.core.exceptions import *
from cccli.printer import Printer, color from cccli.printer import Printer, color
from cccli.command.command import Command from cccli.command.command import Command, OptionCommand
from optparse import OptionParser class Command_rights(OptionCommand):
class Command_rights(Command):
'''List account rights''' '''List account rights'''
def __init__(self, cli, argv0):
OptionCommand.__init__(self, cli, argv0)
self.option.set_usage("%prog [options] [tql]")
self.option.add_option("--raw", action="store_true", dest="raw",
help="Don't append filter on request")
def __call__(self, argv): def __call__(self, argv):
# Parse argline # Parse argline
try: try:
oparser = OptionParser(prog=argv[0]) (options, args) = self.option.parse_args(argv[1:])
oparser.add_option("--raw", action="store_true", dest="raw",
help="Don't append filter on request")
(options, args) = oparser.parse_args(argv[1:])
except SystemExit: except SystemExit:
return return
# append current login if nothing asked # append current login if nothing asked
...@@ -44,9 +45,6 @@ class Command_rights(Command): ...@@ -44,9 +45,6 @@ class Command_rights(Command):
tags = " ".join([ "%s%s:%s%s"%(color["green"], t, color["reset"], v) for (t,v) in r.items() ]) tags = " ".join([ "%s%s:%s%s"%(color["green"], t, color["reset"], v) for (t,v) in r.items() ])
self.printer.out("[%s] %s"%(i,tags)) self.printer.out("[%s] %s"%(i,tags))
def usage(self):
return "Usage: rights [--raw] [--help] [tql]"
class Command_addright(Command): class Command_addright(Command):
'''Add or edit account right''' '''Add or edit account right'''
......
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