Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/pomdtr/dotenv
Run a command with env vars injected from one or more .env files
https://github.com/pomdtr/dotenv
Last synced: about 2 months ago
JSON representation
Run a command with env vars injected from one or more .env files
- Host: GitHub
- URL: https://github.com/pomdtr/dotenv
- Owner: pomdtr
- Created: 2023-02-10T14:57:42.000Z (almost 2 years ago)
- Default Branch: main
- Last Pushed: 2023-02-10T15:04:36.000Z (almost 2 years ago)
- Last Synced: 2024-06-21T17:06:02.517Z (7 months ago)
- Language: Go
- Size: 2.93 KB
- Stars: 1
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# Dotenv - Run a command with env vars injected from one or more .env files
## Installation
```bash
go install github.com/pomdtr/dotenv
```## Usage
```text
Run a command with env vars injected from one or more .env filesUsage:
dotenv [flags] command [args...]Examples:
dotenv -- YOUR_COMMAND --YOUR-FLAG
dotenv --command "YOUR_COMMAND && YOUR_OTHER_COMMAND"Flags:
-c, --command string command to run
--completion string generate completion script
-e, --env strings env files to load
-h, --help help for dotenv
--preserve-env preserve existing environment variables
```> **Note**
> If you pass the `--command` flag, the command will be executed in a subshell. The shell will be determined by the `SHELL` environment variable. If it is not set, `sh` will be used as a fallback. If you want to use a different shell, try: `dotenv -- zsh -c "YOUR_COMMAND"`.## Shell Completions
### Bash
```bash
dotenv --completion bash > /etc/bash_completion.d/dotenv # Linux
dotenv --completion bash > $(brew --prefix)/etc/bash_completion.d/dotenv # macOS
```### Zsh
```zsh
dotenv completion zsh > "${fpath[1]}/_dotenv" # Linux
dotenv completion zsh > $(brew --prefix)/share/zsh/site-functions/_dotenv # macOS
```### Fish
```fish
dotenv --completion fish > ~/.config/fish/completions/dotenv.fish
```### Powershell
```powershell
dotenv --completion powershell | Out-String | Invoke-Expression
```