コード例 #1
0
ファイル: commander.py プロジェクト: joseph8th/mandelbrat
    def __init__(self):
        self.parser = subparsers.add_parser(name = self.name,
                                            description = self.description, 
                                            help = self.help)

        self.group = self.parser.add_argument_group("{} group".format(self.name), 
                                                    "generic configuration".format(self.name))
        self.group.add_argument( 
            "--ls", action='store_true',
            help="list available {}(s)".format(self.name) )
        self.group.add_argument( "--vi", action='store_true',
                                 help="view info about current {}".format(self.name) )
        self.group.add_argument( "--mk", action='store',
                                 help="create a new {} with given name".format(self.name) )
        self.group.add_argument( "--rm", action='store', 
                                 help="remove a {}".format(self.name) )
        self.group.add_argument( "--ck", action='store', 
                                 help="checkout the given {}".format(self.name) )
        self.group.add_argument( "--set", nargs='*',
                                 help="set current {} config properties".format(self.name) )

        ### TODO: add DB support instead of all but keys (which remain file-based)

        # instantiate a ConfigManager and set 'config' attr to manage this section 
        self.cfgmgr = ConfigManager()
        self.config = self.cfgmgr.secmgr[self.name]
コード例 #2
0
    def __init__(self):
        self.parser = subparsers.add_parser(name = self.name,
                                            description = self.description, 
                                            help = self.help)

        self.group = self.parser.add_mutually_exclusive_group()
        self.group.add_argument( 
            "--ls", action='store_true',
            help="list available {}(s)".format(self.name) )
        self.group.add_argument( "--vi", action='store_true',
                                 help="view info about current {}".format(self.name) )
        self.group.add_argument( "--mk", action='store',
                                 help="create a new {} with given name".format(self.name) )
        self.group.add_argument( "--rm", action='store', 
                                 help="remove a {}".format(self.name) )
        self.group.add_argument( "--ck", action='store', 
                                 help="checkout the given {}".format(self.name) )
        self.group.add_argument( "--set", nargs='*',
                                 help="set current {} config properties".format(self.name) )

        # instantiate a ConfigManager and set 'config' attr to manage this section 
        self.cfgmgr = ConfigManager()
        self.config = self.cfgmgr.secmgr[self.name]
コード例 #3
0
 def __init__(self):
     self.parser = subparsers.add_parser(name = self.name,
                                         description = self.description, 
                                         help = self.help)