reliable-shell

0.1.4 • Public • Published

reliable-shell

NPM version node version build status

build shell helper

Requirement

node version >= v5

Install

npm install reliable-shell

Usage

cmd

add command with options

const sh = require('reliable-shell');

sh.cmd('npm -v');

// or with options
sh.cmd('npm -v', [
  'timing', // echo running duration time
  'assert', // assert result ($?) 
  'echo', // echo cmmand name
  'no-fold' // without fold
])

raw

just command, without options

sh.raw('npm -v');

echo

shell command echo alias

sh.echo('npm -v'); // echo "npm -v"

export

shell command export alias

sh.export('KEY', 'VALUE'); // export KEY=VALUE

if

sh.if('-f package.json', () => {
  sh.raw('npm -v');
});
// if [[ -f packages.json ]]; then
//  npm -v
// fi

else

add else after if

elif

sh.elif('-f makefile'); // elif [[ if makefile ]]; then

for

need 3 or 4 arguments

sh.for('i=0', 'i<10', 'i++', () => {
  sh.raw('npm -v');
});

// for(( i=0; i<10; i++ )); do
//   npm -v
// done

sh.for('item', '$(ls)', () => {
  sh.echo('$item');
})

// for item in $(ls); do
//   echo "$item"
// done

LICENSE

MIT

Readme

Keywords

Package Sidebar

Install

npm i reliable-shell

Weekly Downloads

1

Version

0.1.4

License

MIT

Last publish

Collaborators

  • brunoyang