0.1.4 • Published 7 years ago

reliable-shell v0.1.4

Weekly downloads
10
License
MIT
Repository
github
Last release
7 years ago

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

0.1.4

7 years ago

0.1.3

7 years ago

0.1.2

7 years ago

0.1.1

7 years ago

0.1.0

7 years ago