Skip to content

butera-simone/shellblazer

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

20 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

shellblazer

A Node.js module for executing shell commands with less boilerplate.

Installation

To install the module, run the following command in your terminal:

npm i shellblazer

Usage

The module will provide you with a function. Just pass the commands as arrays of strings.

let sh = require('shellblazer')

sh(['mkdir', 'foo'])

The commands are executed with spawn() with {shell: false}, so you cannot pipe output from one command to another.

You can change directory by passing a cwd option to the .configure() method. The method will return a new shellblazer function, that will have the required working directory set:

sh = sh.configure({ cwd: './foo' })
sh(['touch', 'a.txt'])
//this will create the file a.txt inside the foo directory

Shellblazer can execute commands in sequence with a single function call, by taking any number of arrays as arguments

let sh = require ('./index')

sh(['mkdir', 'alpha'], ['mkdir', 'beta'])

About

Simple Node module to execute shell commands

Resources

License

Stars

Watchers

Forks

Packages

No packages published