Ecosyste.ms: Awesome

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

Awesome Lists | Featured Topics | Projects

https://github.com/joseluisq/enve

A cross-platform tool to run a program in a modified environment providing a .env file.
https://github.com/joseluisq/enve

cli-tool dotenv env env-file env-loader environment-variables freebsd golang json-export linux macos openbsd windows xml-export

Last synced: about 2 months ago
JSON representation

A cross-platform tool to run a program in a modified environment providing a .env file.

Awesome Lists containing this project

README

        

# Enve ![devel](https://github.com/joseluisq/enve/workflows/devel/badge.svg) [![PkgGoDev](https://pkg.go.dev/badge/github.com/joseluisq/enve)](https://pkg.go.dev/github.com/joseluisq/enve)

> Run a program in a modified environment providing a `.env` file.

**Enve** is a cross-platform tool that can load environment variables from a [`.env` file](https://www.ibm.com/docs/en/aix/7.2?topic=files-env-file) and execute a given command.
It also can output environment variables in `text`, `json` or `xml` format.

It can be considered as a counterpart of [GNU env](https://www.gnu.org/software/coreutils/manual/html_node/env-invocation.html) command.

## Install

- **Platforms supported:** `linux`, `darwin`, `windows`, `freebsd`, `openbsd`
- **Architectures supported:** `amd64`, `386`, `arm`, `arm64`, `ppc64le`

```sh
curl -sSL \
"https://github.com/joseluisq/enve/releases/download/v1.5.1/enve_v1.5.1_linux_amd64.tar.gz" \
| sudo tar zxf - -C /usr/local/bin/ enve
```

Using Go:

```sh
go install github.com/joseluisq/enve@latest
```

Pre-compiled binaries also available on [joseluisq/enve/releases](https://github.com/joseluisq/enve/releases)

## Usage

By default, **enve** will print all environment variables like `env` command.

```sh
enve
# Or its equivalent
enve --output text
```

### Executing commands

By default, an optional `.env` file can be loaded from the current working directory.

```sh
enve test.sh
```

However it's possible to specify a custom `.env` file using the `--file` or `-f` flags.

```sh
enve --file dev.env test.sh
```

### Printing environment variables

**enve** supports `text`, `json` and `xml` formats.

```sh
enve --output text # or just `enve`
enve --output json
enve --output xml
```

## Options

```
$ enve 1.5.1
Run a program in a modified environment using .env files

USAGE:
enve [OPTIONS] COMMAND

OPTIONS:
-f --file Load environment variables from a file path (optional) [default: .env]
-o --output Output environment variables using text, json or xml format [default: text]
-w --overwrite Overwrite environment variables if already set [default: false]
-h --help Prints help information
-v --version Prints version information
```

## Contributions

Unless you explicitly state otherwise, any contribution intentionally submitted for inclusion in current work by you, as defined in the Apache-2.0 license, shall be dual licensed as described below, without any additional terms or conditions.

Feel free to send some [Pull request](https://github.com/joseluisq/enve/pulls) or file an [issue](https://github.com/joseluisq/enve/issues).

## License

This work is primarily distributed under the terms of both the [MIT license](LICENSE-MIT) and the [Apache License (Version 2.0)](LICENSE-APACHE).

© 2020-present [Jose Quintana](https://joseluisq.net)