{"name":"grunt-shell","version":"0.1.2","description":"Grunt task to run shell commands","keywords":["gruntplugin","grunt","shell","command","exec","cli"],"homepage":"https://github.com/sindresorhus/grunt-shell","bugs":{"name":"https://github.com/sindresorhus/grunt-shell/issues"},"author":{"name":"Sindre Sorhus","email":"sindresorhus@gmail.com","url":"http://sindresorhus.com"},"main":"grunt.js","bin":{"grunt-shell":"bin/grunt-shell"},"repository":{"type":"git","url":"git://github.com/sindresorhus/grunt-shell.git"},"dependencies":{"grunt":"~0.3.10"},"engines":{"node":">=0.6.0"},"licenses":{"type":"MIT"},"_npmUser":{"name":"sindresorhus","email":"sindresorhus@gmail.com"},"_id":"grunt-shell@0.1.2","devDependencies":{},"optionalDependencies":{},"_engineSupported":true,"_npmVersion":"1.1.21","_nodeVersion":"v0.6.19","_defaultsLoaded":true,"dist":{"shasum":"17ff0cf20cf3453917aff0b56c9d23f86da5ff2d","tarball":"http://registry-npm.ywwl.com/grunt-shell/download/grunt-shell-0.1.2.tgz","integrity":"sha512-I+z2aUg2udqmmjkgH5hG3p68M+5cUmBpClyfhaRw1MhboyImEZNVu8cFH/mdA8ec36Nsx0ktcL4Mh/dDkjIN+Q==","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEQCIEPSTtBfdSPUF/hi4uslwyB59qFLiW8bNHiB3bz/JNZpAiAp87nMoXBnjGts/3zKL6nhBF7CgetTsDaYLuCK18mlfw=="}],"size":1123,"noattachment":false,"key":"/grunt-shell/-/grunt-shell-0.1.2.tgz"},"maintainers":[{"name":"sindresorhus","email":"sindresorhus@gmail.com"}],"directories":{},"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":1340911982826,"_cnpm_publish_time":1340911982826,"dist-tags":{"latest":"4.0.0"}}