def main(): """ Here we go. Parse command, choose class and run. """ cmd_dict = get_class_dict() command = get_command_from_argv(cmd_dict.keys()) if command is None: print 'Usage:' + Templates['usage'] sys.exit(2) modtool = cmd_dict[command]() modtool.setup() modtool.run()
def run(self): cmd_dict = get_class_dict() cmds = cmd_dict.keys() cmds.remove(self.name) for a in self.aliases: cmds.remove(a) help_requested_for = get_command_from_argv(cmds) if help_requested_for is None: print 'Usage:' + Templates['usage'] print '\nList of possible commands:\n' print_class_descriptions() return cmd_dict[help_requested_for]().setup_parser().print_help()
def run(self): cmd_dict = get_class_dict(globals().values()) cmds = cmd_dict.keys() cmds.remove(self.name) for a in self.aliases: cmds.remove(a) help_requested_for = get_command_from_argv(cmds) if help_requested_for is None: print 'Usage:' + Templates['usage'] print '\nList of possible commands:\n' print_class_descriptions() return cmd_dict[help_requested_for]().setup_parser().print_help()