Ecosyste.ms: Awesome

An open API service indexing awesome lists of open source software.

Awesome Lists | Featured Topics | Projects

https://github.com/martinheidegger/envif

Commandline utility, outputs process argument 2 if a variable is true else outputs process argument 3 (or not if not given)
https://github.com/martinheidegger/envif

Last synced: about 4 hours ago
JSON representation

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

Awesome Lists containing this project

README

        

# 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
```