diff options
author | Guan <youguanxinqing@qq.com> | 2021-01-08 11:10:39 +0800 |
---|---|---|
committer | GitHub <noreply@github.com> | 2021-01-08 11:10:39 +0800 |
commit | ad936550422c62c1e5cedd1d8266cd95788fbcac (patch) | |
tree | 48f39545e771d608abc6902b4bcf943fb360480e | |
parent | 4a0e044c4688030131a29e83215c6b769ddd5c6a (diff) |
add [] when argument is optional (#372)
* add [] where argument is optional
* add [] when argument is optional
-rw-r--r-- | iredis/utils.py | 5 |
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) |