summaryrefslogtreecommitdiffstats
path: root/iredis/entry.py
diff options
context:
space:
mode:
Diffstat (limited to 'iredis/entry.py')
-rw-r--r--iredis/entry.py19
1 files changed, 16 insertions, 3 deletions
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():