Parses a string similarly to how POSIX shells parse command lines into arguments, and returns an array of strings that correspond to the parsed arguments. Quoting and escaping are supported.
constshellParser=require('shell-parser');>shellParser('ab cd ef');['ab','cd','ef']>shellParser('ab "cd ef"');['ab','cd ef']>shellParser('a "" b');['a','','b']>shellParser("'a'\\''b'");['a\'b']>shellParser('a "bc');Thrown:
Error: Unterminatedquote: "
atquoted(/home/chris/dev/shell-parser/index.js:47:19)atshellParser(/home/chris/dev/shell-parser/index.js:88:18)