コード例 #1
0
ファイル: ruckcommand.py プロジェクト: zodman/PackageKit
    def usage(self):

        rucktalk.message("")
        rucktalk.message("Usage: ruck " + self.name() + " <options> " + \
                       self.arguments())
        rucktalk.message("")

        description = self.description_long() or self.description_short()
        if description:
            description = "'" + self.name() + "': " + description
            for l in ruckformat.linebreak(description, 72):
                rucktalk.message(l)
            rucktalk.message("")

        opts = self.local_opt_table()
        if opts:
            rucktalk.message("'" + self.name() + "' Options:")
            ruckformat.opt_table(opts)
            rucktalk.message("")

        opts = self.default_opt_table()
        if opts:
            rucktalk.message("General Options:")
            ruckformat.opt_table(opts)
            rucktalk.message("")
コード例 #2
0
ファイル: ruckcommand.py プロジェクト: zodman/PackageKit
def usage_full():
    rucktalk.message("Usage: ruck <command> <options> ...")
    rucktalk.message("")

    rucktalk.message("The following options are understood by all commands:")
    ruckformat.opt_table(default_opt_table)

    keys = command_dict.keys()

    if keys:
        command_list = []
        for k in keys:
            description, constructor, aliases, hidden, basic, category  = command_dict[k]
            if not hidden:
                command_list.append([k, aliases, description, category])

        print_command_list(command_list, with_categories=1)

        rucktalk.message("")
        rucktalk.message("For more detailed information about a specific command,")
        rucktalk.message("run 'ruck <command name> --help'.")
        rucktalk.message("")

    else:
        rucktalk.error("<< No commands found --- something is wrong! >>")