Parses a command line into its list: commands joined by ;, && and ||, as POSIX sh reads them. A joiner inside quotes is text. A single | is a pipe and a single & a background mark; neither splits here.
;
&&
||
sh
|
&
The full command line.
The commands in order, each with the condition it runs under.
commandList_parse("cd ~/uploads && pwd") // [{ command: 'cd ~/uploads', when: 'always' }, { command: 'pwd', when: 'success' }]commandList_parse("ls x || echo none; pwd") // ls x: always; echo none: failure; pwd: alwayscommandList_parse("echo 'a && b'") // one command Copy
commandList_parse("cd ~/uploads && pwd") // [{ command: 'cd ~/uploads', when: 'always' }, { command: 'pwd', when: 'success' }]commandList_parse("ls x || echo none; pwd") // ls x: always; echo none: failure; pwd: alwayscommandList_parse("echo 'a && b'") // one command
Parses a command line into its list: commands joined by
;,&&and||, as POSIXshreads them. A joiner inside quotes is text. A single|is a pipe and a single&a background mark; neither splits here.