Simple dotenv CLI.
Project description
# dotenv CLI
Dotenv-CLI is a simple package that provides the dotenv command. It reads the .env file from the current directory puts the contents in the environment and executes the given command.
dotenv supports alternative .env files like .env.development via the -e or –dotenv parametes.
dotenv provides bash completion, so you can use dotenv like this:
`bash $ dotenv make <TAB> all clean docs lint release test `
## Install
### Using PyPi
dotenv-cli is [available on PyPi][pypi], you can install it via:
[pypi]: https://pypi.org/project/dotenv-cli/
`bash $ pip install dotenv-cli `
### On Debian and Ubuntu
Alternatively, you can install dotenv-cli on Debian based distributions via:
`bash # apt-get install python3-dotenv-cli `
## Usage
Create an .env file in the root of your project and populate it with some values like so:
`sh SOME_SECRET=donttrythisathome SOME_CONFIG=foo `
Just prepend the command you want to run with the extra environment variables from the .env file with dotenv:
`bash $ dotenv some-command `
and those variables will be available in your environment variables.
## Rules
The parser understands the following:
Basic unquoted values (BASIC=basic basic)
Lines starting with export (export EXPORT=foo), so you can source the file in bash
Lines starting with # are ignored (# Comment)
Empty values (EMPTY=) become empty strings
Inner quotes are maintained in basic values: INNER_QUOTES=this ‘is’ a test or INNER_QUOTES2=this “is” a test
White spaces are trimmed from unquoted values: TRIM_WHITESPACE= foo ` and maintained in quoted values: `KEEP_WHITESPACE=” foo “
Multi line (and other control characters) are supported in (single or double) quoted values: MULTILINE=”multinline”
Example .env file:
`sh BASIC=basic basic export EXPORT=foo EMPTY= INNER_QUOTES=this 'is' a test INNER_QUOTES2=this "is" a test TRIM_WHITESPACE= foo KEEP_WHITESPACE=" foo " MULTILINE="multi\nline" # some comment `
becomes:
`sh $ dotenv env BASIC=basic basic EXPORT=foo EMPTY= INNER_QUOTES=this 'is' a test INNER_QUOTES2=this "is" a test TRIM_WHITESPACE=foo KEEP_WHITESPACE= foo MULTILINE=multi line `
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Hashes for dotenv_cli-1.3.0-py3-none-any.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | ac7cfb9f0de0eee844d114f6a92eabeb832c97d707dde51789f99c80a5d78b5a |
|
MD5 | 01affa6b5388e15114518d8463f3ecaa |
|
BLAKE2b-256 | e95ee619222ecf74ea1319a459f3386ee142195f57ede5d607ef1a993ab111cf |