还是加上一个额外的判断参数吧

This commit is contained in:
shenjack 2023-09-17 21:07:34 +08:00
parent ce1fc24bff
commit 5d0547246e
Signed by: shenjack
GPG Key ID: 7B1134A979775551

View File

@ -25,13 +25,18 @@ def ensure_cmd_readable(cmd: str) -> str:
return cmd return cmd
def format_cmd(arg_name: Optional[str] = None, arg_value: Optional[Union[str, List[str]]] = None) -> List[str]: def format_cmd(arg_name: Optional[str] = None,
arg_value: Optional[Union[str, List[str]]] = None,
write: Optional[bool] = True) -> List[str]:
""" """
用来格式化输出命令行参数 用来格式化输出命令行参数
:param arg_name: 类似 --show-memory 之类的主项 :param arg_name: 类似 --show-memory 之类的主项
:param arg_value: 类似 xxx 类的内容 :param arg_value: 类似 xxx 类的内容
:param write: 是否写入
:return: 直接拼接好的命令行参数 不带 = :return: 直接拼接好的命令行参数 不带 =
""" """
if not write:
return []
if arg_name is None: if arg_name is None:
return [] return []
if arg_value is None: if arg_value is None: