Skip to content

joseluisq/enve

Repository files navigation

Enve devel PkgGoDev

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 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 command.

Install

  • Platforms supported: linux, darwin, windows, freebsd, openbsd
  • Architectures supported: amd64, 386, arm, arm64, ppc64le
curl -sSL \
   "https://github.com/joseluisq/enve/releases/download/v1.5.0/enve_v1.5.0_linux_amd64.tar.gz" \
   | sudo tar zxf - -C /usr/local/bin/ enve

Using Go:

go install github.com/joseluisq/enve@latest

Pre-compiled binaries also available on joseluisq/enve/releases

Usage

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

enve
# Or its equivalent
enve --output text

Executing commands

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

enve test.sh

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

enve --file dev.env test.sh

Printing environment variables

enve supports text, json and xml formats.

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

Options

$ enve 1.5.0
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 or file an issue.

License

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

© 2020-present Jose Quintana