addok/shell.py
def do_SCRIPT(self, args):
        """Run a Lua script. Takes the raw Redis arguments.
        SCRIPT script_name number_of_keys key1 key2… arg1 arg2
        """
        try:
            name, keys_count, *args = args.split()
        except ValueError:
            print(red('Not enough arguments'))
            return
        try:
            keys_count = int(keys_count)
        except ValueError:
            print(red('You must pass the number of keys as first argument'))
            self.do_HELP('SCRIPT')
            return
        keys = args[:keys_count]
        args = args[keys_count:]
        try:
            output = getattr(scripts, name)(keys=keys, args=args)
        except AttributeError:
            print(red('No script named {}'.format(name)))
            return
        except DB.Error as e:
            print(red(e))
            return
        if not isinstance(output, list):
            # Script may return just an integer.
            output = [output]
        for line in output:
            print(white(line))
def do_SCRIPT(self, args):
        """Run a Lua script. Takes the raw Redis arguments.
        SCRIPT script_name number_of_keys key1 key2… arg1 arg2
        """
        try:
            name, keys_count, *args = args.split()
        except ValueError:
            print(red('Not enough arguments'))
            return
        try:
            keys_count = int(keys_count)
        except ValueError:
            print(red('You must pass the number of keys as first argument'))
            self.do_HELP('SCRIPT')
            return
        keys = args[:keys_count]
        args = args[keys_count:]
        try:
            output = getattr(scripts, name)(keys=keys, args=args)
        except AttributeError:
            print(red('No script named {}'.format(name)))
            return
        except DB.Error as e:
            print(red(e))
            return
        if not isinstance(output, list):
            # Script may return just an integer.
            output = [output]
        for line in output:
            print(white(line))
Run a Lua script. Takes the raw Redis arguments.
        SCRIPT script_name number_of_keys key1 key2… arg1 arg2