While we're wishing in one hand, how is it that our programs still take an input of an array of strings, that get escaped and unescaped and split randomly by our shell scripts?
All sensible ones allow you to just pass an array of parameters to command execution and not worry about spaces in them
run(f”command {arg} -v -p{opt} {target}”)
to run([“command”, arg, “-v”, “-p”, opt, target])It's an array of string parameters.
No semantics! Just an variety of customs about what it means when a parameters begins with a - or a -- or if you have -- by itself preceding some characters, how to break lists of arguments with separators, what happens when you pass the same argument twice, etc etc etc.
To choose the worst possible solution better than that, we could instead be passing in a single string with a JSON dictionary that says things like '{ "recursive": True, "force": True, "files": [ "file1", "file2", "file3" ]}'