Commandline utility, outputs process argument 2 if a variable is true else outputs process argument 3 (or not if not given)
Last updated 6 years ago by leichtgewicht .
ISC · Repository · Bugs · Original npm · Tarball · package.json
$ cnpm install envif 
SYNC missed versions from official npm registry.

Envif - Simple commandline if switch

envif is a small command line tool that outputs one string or another if a environment variable is set to true (not case-sensitive) or 1.


Simple use npm to install it:

$ npm install envif -g


In commandline you can use it like

$ envif MY_VAR "it's set" "it isn't"

if MY_VAR is present and true in this example it will output it's set else it isn't.

This would be a test:

$ env MY_VAR=true  envif MY_VAR "it's set" "it isn't"
it isn't
$ env MY_VAR=false envif MY_VAR "it's set" "it isn't"
it's set

Current Tags

  • 1.0.0                                ...           latest (6 years ago)

1 Versions

  • 1.0.0                                ...           6 years ago
Maintainers (1)
Today 0
This Week 0
This Month 0
Last Day 0
Last Week 0
Last Month 0
Dependencies (0)
Dev Dependencies (2)
Dependents (1)

Copyright 2014 - 2016 © taobao.org |