Skip to content

Evalutes a CLI parameter expression and exits with exit codes based on the boolean outcome of that expression.

Notifications You must be signed in to change notification settings

peol/expr-exit-code

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

3 Commits
 
 
 
 
 
 
 
 
 
 

Repository files navigation

expr-exit-code

Really simple npm CLI module for evaluating CLI parameters and exit a process based on the expressions output (all truthy values = exit code 0, else is exit code 1).

Dev

$ npm install
$ npm dedupe // if npm < 3
$ npm run build

Usage

Replace expr-exit-code with node dist/index.js if in development.

$ npm install -g expr-exit-code

// view available CLI parameters:
$ expr-exit-code --help

// 5>6 is false, exit code 1:
$ expr-exit-code -e "5>6"

// 0 is falsy, exit code 1:
$ expr-exit-code -e "1-1"

// message if expression is truthy:
$ expr-exit-code -e "1+1" -t "It is truthy"

// message if expression is falsy:
$ expr-exit-code -e "0+0" -f "It is falsy"

About

Evalutes a CLI parameter expression and exits with exit codes based on the boolean outcome of that expression.

Resources

Stars

Watchers

Forks

Packages

No packages published