""" Redis module.
"""
import os


def redis(loader, project=None, variant=None, *args): #pylint:disable=keyword-arg-before-vararg
    project, variant = loader.setup_project_env(project, variant)
    loader.setup_shell_env()
    config = loader.get_project_config()

    binargs = [config.get('redis.bin', '/usr/sbin/redis-server')] + list(args)
    os.execvp(binargs[0], binargs)


def redis_run(loader, project=None, variant=None, *args): #pylint:disable=keyword-arg-before-vararg
    project, variant = loader.setup_project_env(project, variant)
    loader.setup_shell_env()
    config = loader.get_project_config()

    binargs = [
        config.get('redis.bin', '/usr/sbin/redis-server'),
        '--bind', os.environ.get('REDIS_LISTEN', '127.0.0.1'),
        '--port', os.environ.get('REDIS_PORT', 6379),
    ]

    filename = config.get('redis.filename')
    if filename:
        filename = os.path.join(os.environ['ROOT_DIR'], filename)
        binargs.append('--dir')
        binargs.append(os.path.dirname(filename))
        binargs.append('--dbfilename')
        binargs.append(os.path.basename(filename))

    max_memory = config.get('redis.max_memory')
    if max_memory:
        binargs.append('--maxmemory')
        binargs.append(max_memory)

    eviction_policy = config.get('redis.eviction_policy')
    if eviction_policy:
        binargs.append('--maxmemory-policy')
        binargs.append(eviction_policy)

    lazy_eviction = config.get('redis.lazy_eviction')
    if lazy_eviction:
        binargs.append('--lazyfree-lazy-eviction')
        binargs.append('yes')

    os.execvp(binargs[0], binargs + list(args))


commands = (redis, redis_run)

@@ -376,16 +376,494 @@
 args)%0A%0A%0A
+def redis_cli(loader, project=None, variant=None, *args): #pylint:disable=keyword-arg-before-vararg%0A    project, variant = loader.setup_project_env(project, variant)%0A    loader.setup_shell_env()%0A    config = loader.get_project_config()%0A%0A    binargs = %5B%0A        config.get('redis.cli.bin', '/usr/bin/redis-cli'),%0A        '-h', os.environ.get('REDIS_LISTEN', '127.0.0.1'),%0A        '-p', os.environ.get('REDIS_PORT', 6379),%0A    %5D%0A%0A    os.execvp(binargs%5B0%5D, binargs + list(args))%0A%0A%0A
 def redi
@@ -2125,16 +2125,27 @@
  (redis,
+ redis_cli,
  redis_r

add redis-cli