Tagged template to run shell script with execa
Branch: master
Clone or download
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Permalink
Type Name Latest commit message Commit time
Failed to load latest commit information.
.circleci
test
.eslintrc.json
.gitignore
CODE_OF_CONDUCT.md
LICENSE.md
README.md
index.js
package-lock.json
package.json
renovate.json

README.md

shella

Tagged template to run shell script with execa.

npm version Node.js Version Support build status dependency status License

Install

$ npm i shella

Usage

shella returns a value that execa returns.

const shella = require('shella');

(async () => {
  // async by default
  await shella`
    echo abcde | sed -e 's/bcd/!!!/' > ./result.txt
    grep a ./result.txt`;

  // interporation (shell-escaped)
  const msg = `Bob's pen`;
  await shella`echo ${msg}`;
})();

// sync
shella.sync`echo foo`;

Options

You can specify options for execa. shella specify stdio: 'inherit' by default, but the other options are execa's default.

// with execa options
const {stdout, stderr} = await shella({stdio: 'pipe'})`echo foo`;
console.log(stdout);

// sync with execa options
shella.sync({stdio: 'pipe'})`echo foo`;

Related

License

MIT License: Teppei Sato <teppeis@gmail.com>