UNPKG

run-commands

Version:

Cross-platform running a series of commands or in parallel flow. Run commands in OS X, Linux and even Windows!

136 lines (96 loc) 6.5 kB
# [run-commands][author-www-url] [![npmjs.com][npmjs-img]][npmjs-url] [![The MIT License][license-img]][license-url] > Cross-platform running a series of commands or in parallel flow. Run commands in OS X, Linux and even Windows! [![code climate][codeclimate-img]][codeclimate-url] [![standard code style][standard-img]][standard-url] [![travis build status][travis-img]][travis-url] [![coverage status][coveralls-img]][coveralls-url] [![dependency status][david-img]][david-url] ## Install ``` npm i run-commands --save ``` ## Usage > For more use-cases see the [tests](./test.js) ```js const runCommands = require('run-commands') ``` ### [runCommands](index.js#L24) > Run commands in series by default, pass `options.parallel: true` to run them on parallel. **Params** * `cmd` **{String|Array}** * `args` **{String|Array|Object|Function=}** * `options` **{Object|Function=}** * `callback` **{Function}** * `returns` **{Stream}** ### [.series](index.js#L47) > Run commands in series. Alias for `runCommands`. **Params** * `cmd` **{String|Array}** * `args` **{String|Array|Object|Function=}** * `options` **{Object|Function=}** * `callback` **{Function}** * `returns` **{Stream}** ### [.parallel](index.js#L65) > Run commands in parallel. **Params** * `cmd` **{String|Array}** * `args` **{String|Array|Object|Function=}** * `options` **{Object|Function=}** * `callback` **{Function}** * `returns` **{Stream}** ## Signatures ```js runCommands(String, String, Object, Function) runCommands(String, Array, Object, Function) runCommands(String, Object, Function) runCommands(String, Function) runCommands(Array<String|Object>, Object, Function) runCommands(Array<String|Object>, Function) ``` ## Related * [async](https://www.npmjs.com/package/async): Higher-order functions and common patterns for asynchronous code | [homepage](https://github.com/caolan/async) * [capture-spawn](https://www.npmjs.com/package/capture-spawn): Asynchronously capturing spawn output. | [homepage](https://github.com/tunnckocore/capture-spawn) * [capture-stream](https://www.npmjs.com/package/capture-stream): Capture stream output. | [homepage](https://github.com/doowb/capture-stream) * [cross-spawn](https://www.npmjs.com/package/cross-spawn): Cross platform child_process#spawn and child_process#spawnSync | [homepage](https://github.com/IndigoUnited/node-cross-spawn) * [cross-spawn-async](https://www.npmjs.com/package/cross-spawn-async): Cross platform child_process#spawn | [homepage](https://github.com/IndigoUnited/node-cross-spawn-async) * [function-arguments](https://www.npmjs.com/package/function-arguments): Get arguments of a function, useful for and used in dependency injectors.… [more](https://www.npmjs.com/package/function-arguments) | [homepage](https://github.com/tunnckocore/function-arguments) * [parse-arguments](https://www.npmjs.com/package/parse-arguments): Parse function to object with same key names as arguments names and… [more](https://www.npmjs.com/package/parse-arguments) | [homepage](https://github.com/tunnckocore/parse-arguments) * [spawn-commands](https://www.npmjs.com/package/spawn-commands): Launches a new process with the given command, with command line arguments… [more](https://www.npmjs.com/package/spawn-commands) | [homepage](https://github.com/jonschlinkert/spawn-commands) ## Contributing Pull requests and stars are always welcome. For bugs and feature requests, [please create an issue](https://github.com/tunnckoCore/run-commands/issues/new). But before doing anything, please read the [CONTRIBUTING.md](./CONTRIBUTING.md) guidelines. ## [Charlike Make Reagent](http://j.mp/1stW47C) [![new message to charlike][new-message-img]][new-message-url] [![freenode #charlike][freenode-img]][freenode-url] [![tunnckoCore.tk][author-www-img]][author-www-url] [![keybase tunnckoCore][keybase-img]][keybase-url] [![tunnckoCore npm][author-npm-img]][author-npm-url] [![tunnckoCore twitter][author-twitter-img]][author-twitter-url] [![tunnckoCore github][author-github-img]][author-github-url] [async]: https://github.com/caolan/async [capture-spawn]: https://github.com/tunnckocore/capture-spawn [cross-spawn-async]: https://github.com/IndigoUnited/node-cross-spawn-async [extend-shallow]: https://github.com/jonschlinkert/extend-shallow [is-real-object]: https://github.com/tunnckocore/is-real-object [isarray]: https://github.com/juliangruber/isarray [lazy-cache]: https://github.com/jonschlinkert/lazy-cache [parse-arguments]: https://github.com/tunnckocore/parse-arguments [npmjs-url]: https://www.npmjs.com/package/run-commands [npmjs-img]: https://img.shields.io/npm/v/run-commands.svg?label=run-commands [license-url]: https://github.com/tunnckoCore/run-commands/blob/master/LICENSE [license-img]: https://img.shields.io/badge/license-MIT-blue.svg [codeclimate-url]: https://codeclimate.com/github/tunnckoCore/run-commands [codeclimate-img]: https://img.shields.io/codeclimate/github/tunnckoCore/run-commands.svg [travis-url]: https://travis-ci.org/tunnckoCore/run-commands [travis-img]: https://img.shields.io/travis/tunnckoCore/run-commands/master.svg [coveralls-url]: https://coveralls.io/r/tunnckoCore/run-commands [coveralls-img]: https://img.shields.io/coveralls/tunnckoCore/run-commands.svg [david-url]: https://david-dm.org/tunnckoCore/run-commands [david-img]: https://img.shields.io/david/tunnckoCore/run-commands.svg [standard-url]: https://github.com/feross/standard [standard-img]: https://img.shields.io/badge/code%20style-standard-brightgreen.svg [author-www-url]: http://www.tunnckocore.tk [author-www-img]: https://img.shields.io/badge/www-tunnckocore.tk-fe7d37.svg [keybase-url]: https://keybase.io/tunnckocore [keybase-img]: https://img.shields.io/badge/keybase-tunnckocore-8a7967.svg [author-npm-url]: https://www.npmjs.com/~tunnckocore [author-npm-img]: https://img.shields.io/badge/npm-~tunnckocore-cb3837.svg [author-twitter-url]: https://twitter.com/tunnckoCore [author-twitter-img]: https://img.shields.io/badge/twitter-@tunnckoCore-55acee.svg [author-github-url]: https://github.com/tunnckoCore [author-github-img]: https://img.shields.io/badge/github-@tunnckoCore-4183c4.svg [freenode-url]: http://webchat.freenode.net/?channels=charlike [freenode-img]: https://img.shields.io/badge/freenode-%23charlike-5654a4.svg [new-message-url]: https://github.com/tunnckoCore/ama [new-message-img]: https://img.shields.io/badge/ask%20me-anything-green.svg