{"name":"shell-quote","version":"1.9.0","keywords":["command","parse","quote","shell"],"author":{"url":"http://substack.net","name":"James Halliday","email":"mail@substack.net"},"license":"MIT","_id":"shell-quote@1.9.0","maintainers":[{"name":"goto-bus-stop","email":"npm@asdf.kooi.me"},{"name":"karissa","email":"krmckelv@gmail.com"},{"name":"ljharb","email":"ljharb@gmail.com"},{"name":"jiwaddell","email":"jacob.im.waddell@gmail.com"}],"homepage":"https://github.com/ljharb/shell-quote","bugs":{"url":"https://github.com/ljharb/shell-quote/issues"},"dist":{"shasum":"e108b1a136586d5964edb3300016d4bedba0fe57","tarball":"http://registry-npm.ywwl.com/shell-quote/download/shell-quote-1.9.0.tgz","fileCount":21,"integrity":"sha512-Iov+JwFv/2HcTpcwNMKd8+IWNb8tboQJNQTkAY/LLVK7gGH9jy+LGkVqPxfekHl+yMmiqXszdGWXgkfml7hjqA==","signatures":[{"sig":"MEYCIQDwHxA5LRnJUGWdbU2W5t5TvzrLFQmsgkKX+N3+7h5UHwIhAJv06FxW05s5zPcAZQEk6YwPTGXcu17ELttz1LTLEOc7","keyid":"SHA256:DhQ8wR5APBvFHLF/+Tc+AYvPOdTpcIDqOhxsBHRwC7U"}],"unpackedSize":33477,"size":11111,"noattachment":false,"key":"/shell-quote/-/shell-quote-1.9.0.tgz"},"main":"index.js","types":"index.d.ts","engines":{"node":">= 0.4"},"funding":{"url":"https://github.com/sponsors/ljharb"},"gitHead":"db09fc7a9e3546807c19e2de2682ec31112a6520","scripts":{"lint":"eslint --ext=js,mjs .","test":"npm run tests-only","prelint":"evalmd README.md","prepack":"npmignore --auto --commentLines=autogenerated","pretest":"npm run lint","version":"auto-changelog && git add CHANGELOG.md","postlint":"tsc -p . && attw -P","posttest":"npx npm@'>=10.2' audit --production","prepublish":"not-in-publish || npm run prepublishOnly","tests-only":"nyc tape 'test/**/*.js'","postversion":"auto-changelog && git add CHANGELOG.md && git commit --no-edit --amend && git tag -f \"v$(node -e \"console.log(require('./package.json').version)\")\"","prepublishOnly":"safe-publish-latest"},"_npmUser":{"name":"ljharb","email":"ljharb@gmail.com","approver":{"name":"ljharb","email":"ljharb@gmail.com"}},"repository":{"url":"git+ssh://git@github.com/ljharb/shell-quote.git","type":"git"},"_npmVersion":"11.16.0","description":"quote and parse shell commands","directories":{},"_nodeVersion":"26.3.1","publishConfig":{"ignore":[".github/workflows","example","CHANGELOG.md"]},"_hasShrinkwrap":false,"auto-changelog":{"output":"CHANGELOG.md","template":"keepachangelog","hideCredit":true,"unreleased":false,"commitLimit":false,"backfillLimit":false,"startingVersion":"1.7.4"},"devDependencies":{"nyc":"^10.3.2","jiti":"^0.0.0","tape":"^5.10.2","eslint":"^10.5.0","evalmd":"^0.0.19","npmignore":"^0.3.5","in-publish":"^2.0.1","typescript":"next","auto-changelog":"^2.6.0","@ljharb/tsconfig":"^0.3.2","safe-publish-latest":"^2.0.0","@arethetypeswrong/cli":"^0.18.2","@ljharb/eslint-config":"^22.2.3"},"_npmOperationalInternal":{"tmp":"tmp/shell-quote_1.9.0_1782362839508_0.8153325991475195","host":"s3://npm-registry-packages-npm-production"},"readme":"# shell-quote <sup>[![Version Badge][npm-version-svg]][package-url]</sup>\n\n[![github actions][actions-image]][actions-url]\n[![coverage][codecov-image]][codecov-url]\n[![License][license-image]][license-url]\n[![Downloads][downloads-image]][downloads-url]\n\n[![npm badge][npm-badge-png]][package-url]\n\nParse and quote shell commands.\n\n# example\n\n## quote\n\n```js\nvar quote = require('shell-quote/quote');\nvar s = quote([ 'a', 'b c d', '$f', '\"g\"' ]);\nconsole.log(s);\n```\n\noutput\n\n```\na 'b c d' \\$f '\"g\"'\n```\n\n## parse\n\n```js\nvar parse = require('shell-quote/parse');\nvar xs = parse('a \"b c\" \\\\$def \\'it\\'\\\\\\'\\'s great\\'');\nconsole.dir(xs);\n```\n\noutput\n\n```\n[ 'a', 'b c', '$def', \"it's great\" ]\n```\n\n## parse with an environment variable\n\n```js\nvar parse = require('shell-quote/parse');\nvar xs = parse('beep --boop=\"$PWD\"', { PWD: '/home/robot' });\nconsole.dir(xs);\n```\n\noutput\n\n```\n[ 'beep', '--boop=/home/robot' ]\n```\n\n## parse with custom escape character\n\n```js\nvar parse = require('shell-quote/parse');\nvar xs = parse('beep ^--boop=\"$PWD\"', { PWD: '/home/robot' }, { escape: '^' });\nconsole.dir(xs);\n```\n\noutput\n\n```\n[ 'beep', '--boop=/home/robot' ]\n```\n\n## parse with unquoted variable splitting\n\n```js\nvar parse = require('shell-quote/parse');\nvar xs = parse('a $T', { T: 'c d' }, { splitUnquoted: true });\nconsole.dir(xs);\n```\n\noutput\n\n```\n[ 'a', 'c', 'd' ]\n```\n\n## parsing shell operators\n\n```js\nvar parse = require('shell-quote/parse');\nvar xs = parse('beep || boop > /byte');\nconsole.dir(xs);\n```\n\noutput:\n\n```\n[ 'beep', { op: '||' }, 'boop', { op: '>' }, '/byte' ]\n```\n\n## parsing shell comment\n\n```js\nvar parse = require('shell-quote/parse');\nvar xs = parse('beep > boop # > kaboom');\nconsole.dir(xs);\n```\n\noutput:\n\n```\n[ 'beep', { op: '>' }, 'boop', { comment: ' > kaboom' } ]\n```\n\n# methods\n\n```js\nvar quote = require('shell-quote/quote');\nvar parse = require('shell-quote/parse');\n```\n\n## quote(args)\n\nReturn a quoted string for the array `args` suitable for using in shell\ncommands.\n\nEach entry of `args` may be a string, or one of the object shapes that\n`parse` emits: `{ op }` (where `op` is one of the control operators\n`||`, `&&`, `;;`, `|&`, `<(`, `<<<`, `>>`, `>&`, `<&`, `&`, `;`, `(`,\n`)`, `|`, `<`, `>`), `{ op: 'glob', pattern }`, or `{ comment }`. Any\nother object shape, an unrecognized `op`, or a `pattern`/`comment`\ncontaining line terminators throws a `TypeError`.\n\nThe output is POSIX shell (`sh`/`bash`) quoting.\nIt is not valid for Windows `cmd.exe` or PowerShell,\nwhose rules differ and, for `cmd.exe`,\nare not solvable in the general case. On Windows,\ndo not build a shell command string from this output;\ninstead pass an argument array to a non-shell API such as\n`child_process.execFile` or `spawn`\n(or the `cross-spawn` package),\nwhich does no shell parsing and needs no quoting.\n\nUse the returned string verbatim as shell input.\nIt is already a complete, escaped shell word (or words);\ndo not wrap it in additional quotes or embed it in `eval '...'`.\nRe-quoting the output (for example, placing it inside single quotes)\nturns its backslash escapes into literal characters and corrupts the value.\n\n## parse(cmd, env={})\n\nReturn an array of arguments from the quoted string `cmd`.\n\nInterpolate embedded bash-style `$VARNAME` and `${VARNAME}` variables with\nthe `env` object which like bash will replace undefined variables with `\"\"`.\n\nBy default an expanded variable is a single token even when unquoted.\nPass `{ splitUnquoted: true }` to split an unquoted expansion into multiple tokens the way a shell performs field splitting,\nusing the default `IFS` (space, tab, newline).\nPass a string to use its characters as the `IFS` instead\n(for example `{ splitUnquoted: ':' }`).\nA quoted expansion (`\"$VAR\"`) is never split.\n\nOnly simple `$VARNAME` and `${VARNAME}` interpolation is supported.\nBash parameter expansion beyond a plain variable name is not evaluated:\nforms such as array subscripts (`${arr[i]}`), length (`${#arr[@]}`),\nand modifiers (`${var:-default}`, `${var/a/b}`)\nare treated as an unknown variable and expand to `\"\"`,\nwhile arithmetic (`$((...))`) and command substitution (`$(...)`)\nare not interpreted.\nWhitespace inside `${...}` throws a `Bad substitution` error.\n\n`env` is usually an object but it can also be a function to perform lookups.\nWhen `env(key)` returns a string, its result will be output just like `env[key]` would.\nWhen `env(key)` returns an object, it will be inserted into the result\narray like the operator objects.\n\nWhen a bash operator is encountered,\nthe element in the array with be an object with an `\"op\"` key set to the operator string.\nFor example:\n\n```\n'beep || boop > /byte'\n```\n\nparses as:\n\n```\n[ 'beep', { op: '||' }, 'boop', { op: '>' }, '/byte' ]\n```\n\n# install\n\nWith [npm](http://npmjs.org) do:\n\n```\nnpm install shell-quote\n```\n\n# license\n\nMIT\n\n[package-url]: https://npmjs.org/package/shell-quote\n[npm-version-svg]: https://versionbadg.es/ljharb/shell-quote.svg\n[deps-svg]: https://david-dm.org/ljharb/shell-quote.svg\n[deps-url]: https://david-dm.org/ljharb/shell-quote\n[npm-badge-png]: https://nodei.co/npm/shell-quote.png?downloads=true&stars=true\n[license-image]: https://img.shields.io/npm/l/shell-quote.svg\n[license-url]: LICENSE\n[downloads-image]: https://img.shields.io/npm/dm/shell-quote.svg\n[downloads-url]: https://npm-stat.com/charts.html?package=shell-quote\n[codecov-image]: https://codecov.io/gh/ljharb/shell-quote/branch/main/graphs/badge.svg\n[codecov-url]: https://app.codecov.io/gh/ljharb/shell-quote/\n[actions-image]: https://img.shields.io/github/check-runs/ljharb/shell-quote/main\n[actions-url]: https://github.com/ljharb/shell-quote/actions\n","publish_time":1782362839588,"_cnpm_publish_time":1782362839588,"dist-tags":{"latest":"1.12.0"}}