예제 #1
0
    def usage(self):

        nmtalk.message("")
        nmtalk.message("Usage: nm " + self.name() + " <options> " + \
                       self.arguments())
        nmtalk.message("")

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

        opts = self.local_opt_table()
        if opts:
            nmtalk.message("'" + self.name() + "' Options:")
            nmformat.opt_table(opts)
            nmtalk.message("")
        
        opts = self.default_opt_table()
        if opts:
            nmtalk.message("General Options:")
            nmformat.opt_table(opts)
            nmtalk.message("")

        exit(1)
예제 #2
0
def usage_full():
    nmtalk.message("Usage: nm <command> <options> ...")
    nmtalk.message("")

    nmtalk.message("The following options are understood by all commands:")
    nmformat.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)

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

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