def _cli(self, name, command, *args): try: func = self.cmds_by_name[command.lower()] except KeyError: guess = util.closest_option(command, list(self.cmds_by_name)) if guess: raise errors.ArgumentError( 'Unknown command "{0}". Did you mean "{1}"?' .format(command, guess)) raise errors.ArgumentError('Unknown command "{0}"'.format(command)) return func('{0} {1}'.format(name, command), *args)
def get_best_guess(self, passed_in_arg): return util.closest_option(passed_in_arg, list(self.sig.aliases))