This grammar allows you to parse command lines for program execution into their various components - specifically: environment variables, the executable itself and any arguments passed to the executable.
It will take an input like the following:
ENV_X=true ENV_Y="yes please" ./test/my_exec arg1 -f1 "arg with spaces" 'another arg' --flag2 yet\ another\ arg --flag=10
And transform it into an object which can be used to start the specified program in the correct environment, with the correct arguments.
{
"env": [
"ENV_X=true",
"ENV_Y=yes please"
],
"exec": "./test/my_exec",
"args": [
"arg1",
"-f1",
"arg with spaces",
"another arg",
"--flag2",
"yet another arg",
"--flag=10"
]
}
This grammar places particular emphasis on matching Bash's environment escaping behaviour so that users familiar with invoking commands via a command line should be able to make use of systems with this grammar.