{"name":"grunt-shell","version":"4.0.0","description":"Run shell commands","license":"MIT","repository":{"type":"git","url":"git+https://github.com/sindresorhus/grunt-shell.git"},"funding":"https://github.com/sponsors/sindresorhus","author":{"name":"Sindre Sorhus","email":"sindresorhus@gmail.com","url":"https://sindresorhus.com"},"engines":{"node":">=12"},"scripts":{"test":"xo && grunt"},"keywords":["gruntplugin","shell","command","cmd","exec","spawn","child","process","cli"],"dependencies":{"chalk":"^3.0.0","npm-run-path":"^2.0.0","strip-ansi":"^6.0.1"},"devDependencies":{"grunt":"^1.0.1","grunt-cli":"^1.2.0","xo":"^0.23.0"},"peerDependencies":{"grunt":">=1"},"gitHead":"f59d848840eb931fe200d634fcdcb7d0ead1b800","bugs":{"url":"https://github.com/sindresorhus/grunt-shell/issues"},"homepage":"https://github.com/sindresorhus/grunt-shell#readme","_id":"grunt-shell@4.0.0","_nodeVersion":"12.22.1","_npmVersion":"8.3.2","dist":{"integrity":"sha512-dHFy8VZDfWGYLTeNvIHze4PKXGvIlDWuN0UE7hUZstTQeiEyv1VmW1MaDYQ3X5tE3bCi3bEia1gGKH8z/f1czQ==","shasum":"9b04a18a59c3113f24391a3fb5625320538cbd1c","tarball":"http://registry-npm.ywwl.com/grunt-shell/download/grunt-shell-4.0.0.tgz","fileCount":4,"unpackedSize":8337,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v4.10.10\r\nComment: https://openpgpjs.org\r\n\r\nwsFzBAEBCAAGBQJiNhruACEJED1NWxICdlZqFiEECWMYAoorWMhJKdjhPU1b\r\nEgJ2VmqTiQ//ZDGdxvimbg1KYI/oXyfLV9IGNa6btIsQfekyrjOvrvSBa1QN\r\neBN6unnq4XXQ1BI1LzGRMn4d8Do86Gp0tvYHMOMrRQ7OqdR4NyEG43jzJB8J\r\nwXw9c/W/oc+UFpt9vwZN+QVe7HrSucfjVEsvMfUbyjmcpCghQu4XD6I0FS3B\r\nrukn7Y1xo8C1fw9NcW3lNmR9D1peSu/x7lcdp+sgwMHL87+oamyJ/Igt/ADH\r\nc21anu6+oTSZSxb6wxW9CkQtOKVZB3KVSJlx9GaKnFPR7IVfZQJkAyqIC9zJ\r\nTbx4E+ybr2s5uLyjeF05je2S7OrGbySRzUzYlqAiYCyyMGicgeSLEPxYmUUv\r\nJAc0soKUak/WW8Mr8NESPEE2Nl9sD+AVh7DR/CfhEEdNV2nsRSJWKuf8Vwb8\r\nAxuOfsoNsF2lFnEEQcFs/4wCHHxrOEW16hfWOEIBCn3X+57l+jRAqqLhiEwF\r\nz0HLYGyeAbTgjfYc0cww1dkbl7Rea54/7XvnUhzKhvfnteBjRFRid/UR7GY7\r\njH7ecUA4pZg+V8UEhOcmwCPvY8uiFTqVX9g2Pj8oLfhgyJwoXttM9LolbuOm\r\nEnjI+is7HH/X9gTJt5AWGuPEXhFqLQrItcm3JVDWCcAL1g0+/wKljgvZDOGW\r\nld4eI9tm6uP1Zl8V9dl90aCeasTBRxfAHk8=\r\n=tv+U\r\n-----END PGP SIGNATURE-----\r\n","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEQCIAZy3p9oWkPezYIOVWDAlZkQ2cThTk9UCxrVfFx7fr8qAiArtdzkwZavzya6rSTzZQwv0u6YOnMw37kk1wfx/jwfYg=="}],"size":3594,"noattachment":false,"key":"/grunt-shell/-/grunt-shell-4.0.0.tgz"},"_npmUser":{"name":"sindresorhus","email":"sindresorhus@gmail.com"},"directories":{},"maintainers":[{"name":"sindresorhus","email":"sindresorhus@gmail.com"}],"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/grunt-shell_4.0.0_1647713005789_0.09583183276877416"},"_hasShrinkwrap":false,"readme":"# grunt-shell\n\n> Run shell commands\n\nA good way to interact with other CLI tools. For example, get the current Git branch with `git branch`.\n\n## Install\n\n```sh\nnpm install --save-dev grunt-shell\n```\n\n## Usage\n\n```js\nrequire('load-grunt-tasks')(grunt);\n\ngrunt.initConfig({\n\tshell: {\n\t\toptions: {\n\t\t\tstderr: false\n\t\t},\n\t\ttarget: {\n\t\t\tcommand: 'ls'\n\t\t},\n\t\tanother: 'ls ./src' // Shorthand\n\t}\n});\n\ngrunt.registerTask('default', ['shell']);\n```\n\n## Examples\n\n### Run command\n\nCreate a folder named `test`.\n\n```js\ngrunt.initConfig({\n\tshell: {\n\t\tmakeDir: {\n\t\t\tcommand: 'mkdir test'\n\t\t}\n\t}\n});\n```\n\nThe `command` property supports templates:\n\n```js\ngrunt.initConfig({\n\ttestDir: 'test',\n\tshell: {\n\t\tmakeDir: {\n\t\t\tcommand: 'mkdir <%= testDir %>'\n\t\t}\n\t}\n});\n```\n\nYou can also supply a function that returns the command:\n\n```js\ngrunt.initConfig({\n\tshell: {\n\t\thello: {\n\t\t\tcommand: () => 'echo hello'\n\t\t}\n\t}\n});\n```\n\nWhich can also take arguments:\n\n```js\nmodule.exports = grunt => {\n\tgrunt.loadNpmTasks('grunt-shell');\n\tgrunt.initConfig({\n\t\tshell: {\n\t\t\tgreet: {\n\t\t\t\tcommand: greeting => `echo ${greeting}`\n\t\t\t}\n\t\t}\n\t});\n\tgrunt.registerTask('default', ['shell:greet:hello']);\n}\n```\n\n### Run command and display the output\n\nOutput a directory listing in your Terminal.\n\n```js\ngrunt.initConfig({\n\tshell: {\n\t\tdirListing: {\n\t\t\tcommand: 'ls'\n\t\t}\n\t}\n});\n```\n\n### Custom callback\n\nDo whatever you want with the output.\n\n```js\nfunction log(error, stdout, stderr, callback) {\n\tif (error) {\n\t\tcallback(error);\n\t\treturn;\n\t}\n\n\tconsole.log(stdout);\n\tcallback();\n}\n\ngrunt.initConfig({\n\tshell: {\n\t\tdirListing: {\n\t\t\tcommand: 'ls',\n\t\t\toptions: {\n\t\t\t\tcallback: log\n\t\t\t}\n\t\t}\n\t}\n});\n```\n\n### Option passed to the .exec() method\n\nRun a command in another directory. In this example, we run it in a subfolder using the `cwd` (current working directory) option.\n\n```js\ngrunt.initConfig({\n\tshell: {\n\t\tsubfolderLs: {\n\t\t\tcommand: 'ls',\n\t\t\toptions: {\n\t\t\t\tstderr: false,\n\t\t\t\texecOptions: {\n\t\t\t\t\tcwd: 'tasks'\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t}\n});\n```\n\n### Multiple commands\n\nRun multiple commands by placing them in an array which is joined using `&&` or `;`. `&&` means run this only if the previous command succeeded. You can also use `&` to have the commands run concurrently (by executing all commands except the last one in a subshell).\n\n```js\ngrunt.initConfig({\n\tshell: {\n\t\tmultiple: {\n\t\t\tcommand: [\n\t\t\t\t'mkdir test',\n\t\t\t\t'cd test',\n\t\t\t\t'ls'\n\t\t\t].join('&&')\n\t\t}\n\t}\n});\n```\n\n\n## Config\n\n### command\n\n*Required*\\\nType: `string | Function`\n\nCommand to run or a function which returns the command. Supports underscore templates.\n\n*Command can be omitted by directly setting the target with the command.*\n\n### cwd\n\nType: `string`\n\nShortcut. Same as `options.execOptions.cwd` (see below).\n\n## Options\n\n### stdout\n\nType: `boolean`\\\nDefault: `true`\n\nShow stdout in the terminal.\n\n### stderr\n\nType: `boolean`\\\nDefault: `true`\n\nShow stderr in the terminal.\n\n### stdin\n\nType: `boolean`\\\nDefault: `true`\n\nForward the terminal's stdin to the command.\n\n### failOnError\n\nType: `boolean`\\\nDefault: `true`\n\nFail task if it encounters an error. Does not apply if you specify a `callback`.\n\n### stdinRawMode\n\nType: `boolean`\\\nDefault: `false`\n\nSet `stdin` to [act as a raw device](https://nodejs.org/api/tty.html#tty_readstream_setrawmode_mode).\n\n### callback(error, stdout, stderr, callback)\n\nType: `Function`\n\nLets you override the default callback with your own.\n\n**Make sure to call the `callback` method when you're done.** Supply an error as the first argument to `callback` to print a warning and cause the task to fail.\n\n### preferLocal\n\nType: `boolean`\\\nDefault: `true`\n\nExecute local binaries by name like [`$ npm run-script`](https://www.keithcirkel.co.uk/how-to-use-npm-as-a-build-tool/).\n\n### execOptions\n\nType: `object`\n\nSpecify some options to be passed to the [.exec()](https://nodejs.org/api/child_process.html#child_process_child_process_exec_command_options_callback) method:\n\n- `cwd` string *Current working directory of the child process*\n- `env` Object *Environment key-value pairs*\n- `setsid` boolean\n- `encoding` string *(Default: `'utf8'`)*\n- `timeout` number *(Default: `0`)*\n- `maxBuffer` number *(Default: `1000 * 1000 * 10` → 10 MB)*\n- `killSignal` string *(Default: `'SIGTERM'`)*\n","publish_time":1647713006168,"_cnpm_publish_time":1647713006168,"dist-tags":{"latest":"4.0.0"}}