shell_quote¶
-
privex.helpers.common.
shell_quote
(*args: str) → str[source]¶ Takes command line arguments as positional args, and properly quotes each argument to make it safe to pass on the command line. Outputs a string containing all passed arguments properly quoted.
Uses
shlex.join()
on Python 3.8+, and a for loop ofshlex.quote()
on older versions.Example:
>>> print(shell_quote('echo', '"orange"')) echo '"orange"'