From d71fd6264d58795c50b9350d7c39677b671e0896 Mon Sep 17 00:00:00 2001 From: Daniel Baumann Date: Sat, 17 Jul 2021 09:34:48 +0200 Subject: Merging upstream version 1.9.4. Signed-off-by: Daniel Baumann --- iredis/entry.py | 19 ++++++++++++++++--- 1 file changed, 16 insertions(+), 3 deletions(-) (limited to 'iredis/entry.py') diff --git a/iredis/entry.py b/iredis/entry.py index 8e396a4..eb57668 100644 --- a/iredis/entry.py +++ b/iredis/entry.py @@ -266,6 +266,7 @@ PAGER_HELP = """Using pager when output is too tall for your window, default to help="Config file for iredis, default is ~/.iredisrc.", ) @click.option("--decode", default=None, help=DECODE_HELP) +@click.option("--client_name", help="Assign a name to the current connection.") @click.option("--raw/--no-raw", default=None, is_flag=True, help=RAW_HELP) @click.option("--rainbow/--no-rainbow", default=None, is_flag=True, help=RAINBOW) @click.option("--shell/--no-shell", default=None, is_flag=True, help=SHELL) @@ -278,6 +279,7 @@ def gather_args( p, n, password, + client_name, newbie, iredisrc, decode, @@ -319,7 +321,8 @@ def gather_args( if not sys.stdout.isatty(): config.raw = True - config.newbie_mode = newbie + if newbie is not None: + config.newbie_mode = newbie if decode is not None: config.decode = decode @@ -366,6 +369,7 @@ def create_client(params): port = params["p"] db = params["n"] password = params["password"] + client_name = params["client_name"] dsn_from_url = None dsn = params["dsn"] @@ -385,10 +389,19 @@ def create_client(params): path=dsn_from_url.path, scheme=dsn_from_url.scheme, username=dsn_from_url.username, + client_name=client_name, ) if params["socket"]: - return Client(scheme="unix", path=params["socket"], db=db, password=password) - return Client(host=host, port=port, db=db, password=password) + return Client( + scheme="unix", + path=params["socket"], + db=db, + password=password, + client_name=client_name, + ) + return Client( + host=host, port=port, db=db, password=password, client_name=client_name + ) def main(): -- cgit v1.2.3