Elijah Shaw-Rutschman 5606c1fd5d Better dockerRunArgs handling, ensure slug is lowercase | преди 4 години | |
---|---|---|
.. | ||
.github | преди 4 години | |
test | преди 4 години | |
.eslintrc.json | преди 4 години | |
LICENSE | преди 4 години | |
README.md | преди 4 години | |
package.json | преди 4 години | |
shlex.d.ts | преди 4 години | |
shlex.js | преди 4 години |
node-shlex
is a Node.js module for quoting and parsing shell commands.
The API was inspired by the shlex
module from the Python Standard
Library. However, the Python implementation is fairly complex, and supports a
confusing matrix of modes that is not replicated here. node-shlex
always
operates in what the Python module calls "POSIX mode."
As of version 2.0.0, Bash's ANSI C strings ($'x'
) and
locale-specific translation strings ($"x"
) are supported. This
diverges from the Python shlex
behavior but makes parsing more accurate.
Note that node-shlex
does not attempt to split on or otherwise parse
operators (such as 2>/dev/null
), and it does not perform variable
interpolation.
shlex.quote()
var quote = require("shlex").quote
quote("abc") // returns: abc
quote("abc def") // returns: 'abc def'
quote("can't") // returns: 'can'"'"'t'
shlex.split()
var split = require("shlex").split
split('ls -al /') // returns: [ 'ls', '-al', '/' ]
split('rm -f "/Volumes/Macintosh HD"') // returns [ 'rm', '-f', '/Volumes/Macintosh HD' ]