envdo

command module
v0.2.1 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Sep 19, 2025 License: MIT Imports: 1 Imported by: 0

README

envdo

Execute commands with environment variables from .env files.

Features

  • Load environment variables from .env files
  • Support profile-based environment files (.env.{profile})
  • Priority-based directory search (current directory > $XDG_CONFIG_HOME/envdo)
  • Execute any command with loaded environment variables
  • Display loaded environment variables in export format

Usage

Basic usage
$ envdo -- echo $MY_VAR
With profile
$ envdo --profile production -- node app.js
$ envdo -p dev -- npm start
Show loaded environment variables
$ envdo
export API_KEY=your_api_key
export DATABASE_URL=postgresql://localhost/mydb

.env files

envdo searches for .env files in the following directories in order of priority:

  1. Current directory
  2. $XDG_CONFIG_HOME/envdo (typically ~/.config/envdo)
Basic .env file format
# Comments are supported
API_KEY=your_api_key
DATABASE_URL=postgresql://localhost/mydb

# Quoted values are supported
SECRET="my secret value"
ANOTHER_SECRET='another secret'
Profile-based .env files

When using the --profile option, envdo looks for .env.{profile} files:

$ envdo --profile production -- node app.js
# Loads .env.production

Install

homebrew tap:

$ brew install k1LoW/tap/envdo

manually:

Download binary from releases page

go install:

$ go install github.com/k1LoW/envdo@latest

deb:

$ export ENVDO_VERSION=X.X.X
$ curl -o envdo.deb -L https://github.com/k1LoW/envdo/releases/download/v$ENVDO_VERSION/envdo_$ENVDO_VERSION-1_amd64.deb
$ dpkg -i envdo.deb

RPM:

$ export ENVDO_VERSION=X.X.X
$ yum install https://github.com/k1LoW/envdo/releases/download/v$ENVDO_VERSION/envdo_$ENVDO_VERSION-1_amd64.rpm

Documentation

Overview

Copyright © 2025 Ken'ichiro Oyama <k1lowxb@gmail.com>

Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.

Directories

Path Synopsis

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL