def execute_command(name, options, *args): ''' Executes an evolve command by name with the supplied options and arguments. Returns the result code of the command, or 1 in case of an invocation error. ''' command = get_command(name) logger = get_logger( _CommandLog, logging.DEBUG if options.debug else logging.INFO ) try: result = command(options, *args) except TypeError, ex: # TODO: kind of crappy but it works if -1 != str(ex).find('__call__() takes '): raise UsageError('argument mismatch (type `help\' <command> for usage)') raise
def __init__(self, path): self.path = path.strip().rstrip('/') self._validate_repo() self.logger = get_logger(path + '/.logs/repo.log', logging.INFO)