Skip to content
This repository has been archived by the owner on Jul 24, 2023. It is now read-only.
/ shella Public archive

Tagged template to run shell script with execa

License

Notifications You must be signed in to change notification settings

teppeis/shella

Repository files navigation

Use https://github.com/google/zx instead. This repo is archived.


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>