1.0.2 • Published 5 years ago

@teleology/shell v1.0.2

Weekly downloads
-
License
MIT
Repository
gitlab
Last release
5 years ago

@teleology/shell

Downloads Version License

@teleology/shell is a light wrapper around chld_process that makes use of template literals. This adds the benefit of creating cleaner code when using shell commands in Node scripts.

Installation

npm install -D @teleology/shell 

or

yarn add -D @teleology/shell

Usage

Synchronous Example:

const { shell } = require('@teleology/shell');

const world = 'Omicron Persei 8';

shell`
mkdir test &&
echo "hello ${world}" ;
`;
// Output: hello Omicron Persei 8

Asynchronous Example:

const { asyncShell } = require('@teleology/shell');

const queued = asyncShell`
rm -rf test
`;

// executed when `queued` method is invoked
queued((error, stdout, stderr) => {
  console.log(error, stdout, stderr);
});
// Output: null '' ''

**Info on Template Literals can be found here