def get_command(argv, config): try: opts, commands = getopt.getopt(argv, 'c:t:ihvy', ['help', 'version']) except getopt.error as msg: return ErrorCommand(msg) if len(commands) > 1: return ErrorCommand('Too many arguments') if len(commands) == 0: command = 'rec' elif len(commands) == 1: command = commands[0] cmd = None title = None skip_confirmation = False for opt, arg in opts: if opt in ('-h', '--help'): return HelpCommand() elif opt in ('-v', '--version'): return VersionCommand() elif opt == '-c': cmd = arg elif opt == '-t': title = arg elif opt == '-y': skip_confirmation = True if command == 'rec': return RecordCommand(config.api_url, config.api_token, cmd, title, skip_confirmation) elif command == 'auth': return AuthCommand(config.api_url, config.api_token) return ErrorCommand("'%s' is not an asciinema command" % command)
def create_command(self, skip_confirmation): return RecordCommand('http://the/url', 'a1b2c3', 'ls -l', 'the title', skip_confirmation, False, self.recorder, self.uploader, self.confirmator)
def rec_command(args, config): api = Api(config.api_url, os.environ.get("USER"), config.install_id) return RecordCommand(api, args)
def rec_command(args, config): api = Api(config.api_url, os.environ.get("USER"), config.api_token) return RecordCommand(api, args.filename, args.command, args.title, args.yes, args.quiet, args.max_wait)