aboutsummaryrefslogtreecommitdiff
path: root/node_modules/coa/src/shell.coffee
blob: efad108db76228942b2e8c0b8db5597613c1c229 (plain)
1
2
3
4
5
6
7
8
9
10
exports.unescape = (w) ->
    w = if w.charAt(0) is '"'
        w.replace(/^"|([^\\])"$/g, '$1')
    else
        w.replace(/\\ /g, ' ')
    w.replace(/\\("|'|\$|`|\\)/g, '$1')

exports.escape = (w) ->
    w = w.replace(/(["'$`\\])/g,'\\$1')
    if w.match(/\s+/) then '"' + w + '"' else w