Parse command line with shlex

I put that in shells so that weird shells might try to parse it
differently.
This commit is contained in:
mcarton
2015-10-28 14:01:14 +01:00
parent 346cb99217
commit dae58211ba
3 changed files with 39 additions and 16 deletions
+4 -4
View File
@@ -146,10 +146,10 @@ def replace_command(command, broken, matched):
@memoize
def is_app(command, *app_names):
"""Returns `True` if command is call to one of passed app names."""
for name in app_names:
if command.script == name \
or command.script.startswith(u'{} '.format(name)):
return True
if command.split_script is not None and len(command.split_script) > 0:
app = command.split_script[0]
return app in app_names
return False