shella

Tagged template to run shell script with `execa`.


Keywords
execa, shell, tagged, template
License
MIT
Install
npm install shella@1.0.1

Documentation

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>