Skip to content

Commandline utility, outputs process argument 2 if a variable is true else outputs process argument 3 (or not if not given)

Notifications You must be signed in to change notification settings

martinheidegger/envif

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

1 Commit
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

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.

Installation

Simple use npm to install it:

$ npm install envif -g

Usage

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

About

Commandline utility, outputs process argument 2 if a variable is true else outputs process argument 3 (or not if not given)

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published