Exemplo n.º 1
0
 def __init__(self, manager):
     parser = NullCommandParser(prog = GEN_BASH_COMPLETION_COMMAND,
                                description = self.__doc__)
     parser.add_command(callback = self.callback,
                        narg = 1,
                        completion_policies = [FileCompletionPolicy()])
     KasabakeCommandPlugin.__init__(self, manager,
                             GEN_BASH_COMPLETION_COMMAND,
                             parser,
                             GEN_BASH_COMPLETION_DIR)
     return
Exemplo n.º 2
0
 def __init__(self, manager):
     parser = CommandParser(prog = INSTALL_PLUGIN_COMMAND,
                                description = self.__doc__)
     parser.add_command("install", "get",
                        narg = 3,
                        completion_policies = [NullCompletionPolicy(),
                                               NullCompletionPolicy(),
                                               NullCompletionPolicy()],
                        callback = self.install,
                        help = "install a plugin")
     parser.add_command("update", "upgrade",
                        narg = 1,
                        completion_policies = [NullCompletionPolicy()],
                        callback = self.update,
                        help = "update a plugin")
     KasabakeCommandPlugin.__init__(self, manager,
                                    INSTALL_PLUGIN_COMMAND,
                                    parser,
                                    INSTALL_PLUGIN_DIR)
     return
Exemplo n.º 3
0
    def __init__(self, manager):
        parser = NullCommandParser(prog = DESCRIBE_PLUGIN_COMMAND,
                                   description = self.__doc__,
                                   usage = """%prog [options] plugin-name""")
        parser.add_option("-P", "--no-path", action = "store_true",
                          dest = "no_path",
                          default = False,
                          help = """does not print the path where \
the plugin installed""")
        parser.add_option("-U", "--no-usage", action = "store_true",
                          dest = "no_usage",
                          default = False,
                          help = """does not print the usage of the plugin""")
        parser.add_option("-N", "--no-nanme", action = "store_true",
                          dest = "no_name",
                          default = False,
                          help = """does not print the name of the plugin""")
        parser.add_option("-o", "--options", action = "store_true",
                          dest = "options",
                          default = False,
                          help = "print the list of options")
        parser.add_option("--no-arg-options", action = "store_true",
                          dest = "no_arg_options",
                          default = False,
                          help = """only print the options does not require \
arguments. this options is valid if you call with -o option.""")
        parser.add_option("--arg-options", action = "store_true",
                          dest = "arg_options",
                          default = False,
                          help = """only print the options require \
arguments. this options is valid if you call with -o option.""")
        list_plugins = InvokeCommandCompletionPolicy("kasabake list-commands -s")
        parser.add_command(callback = self.callback,
                           narg = 1,
                           completion_policies = [list_plugins])
        KasabakeCommandPlugin.__init__(self, manager,
                                       DESCRIBE_PLUGIN_COMMAND,
                                       parser,
                                       DESCRIBE_PLUGIN_DIR)
        return
Exemplo n.º 4
0
    def __init__(self, manager):
        parser = CommandParser(prog = DB_COMMAND,
                               description = self.__doc__)
        parser.add_command("cat",
                           narg = 0,
                           callback = self.printXML,
                           help = "print your DB xml")
        parser.add_option("-w", "--over-write", dest = "over_write",
                          action = "store_true",
                          default = False,
                          help = """overwrite the values if DB has the \
same value""")
        parser.add_option("-x", "--format-as-xml", dest = "format_as_xml",
                          action = "store_true",
                          default = False,
                          help = """print the xml value in xml format""")
        parser.add_command("init", "initialize",
                           narg = 0,
                           callback = self.initializeXML,
                           help = "initialize your DB xml")
        parser.add_command("get",
                           narg = 1,
                           callback = self.printXMLValue,
                           help = "get an XML value as a dictionary")
        parser.add_command("set",
                           narg = 2,
                           callback = self.setXMLValue,
                           help = "set an XML value.")
        parser.add_command("append",
                           narg = 1,
                           callback = self.appendXML,
                           help = "append an XML file into DB")
        KasabakeCommandPlugin.__init__(self, manager,
                                       DB_COMMAND,
                                       parser,
                                       DB_DIR)
        return