summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorGuan <youguanxinqing@qq.com>2021-01-08 11:10:39 +0800
committerGitHub <noreply@github.com>2021-01-08 11:10:39 +0800
commitad936550422c62c1e5cedd1d8266cd95788fbcac (patch)
tree48f39545e771d608abc6902b4bcf943fb360480e
parent4a0e044c4688030131a29e83215c6b769ddd5c6a (diff)
add [] when argument is optional (#372)
* add [] where argument is optional * add [] when argument is optional
-rw-r--r--iredis/utils.py5
1 files changed, 4 insertions, 1 deletions
diff --git a/iredis/utils.py b/iredis/utils.py
index 5340716..ed42daf 100644
--- a/iredis/utils.py
+++ b/iredis/utils.py
@@ -104,7 +104,10 @@ def parse_argument_to_formatted_text(
result = []
if isinstance(name, str):
_type = type_convert.get(_type, _type)
- result.append((f"class:{style_class}.{_type}", " " + name))
+ if is_option:
+ result.append((f"class:{style_class}.{_type}", f" [{name}]"))
+ else:
+ result.append((f"class:{style_class}.{_type}", f" {name}"))
elif isinstance(name, list):
for inner_name, inner_type in zip(name, _type):
inner_type = type_convert.get(inner_type, inner_type)