shella
v1.0.1
Published
Tagged template to run shell script with `execa`.
Downloads
6
Readme
shella
Tagged template to run shell script with execa
.
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
- execa: A better
child_process
- @tehshrike/shell-escape-tag: shell-escape-tag, but with a much smaller install size
License
MIT License: Teppei Sato <[email protected]>