Skip to content

Latest commit

 

History

History
90 lines (65 loc) · 2.32 KB

README.md

File metadata and controls

90 lines (65 loc) · 2.32 KB

npm

env-cmd

A simple program for executing commands using an environment from an env file.

💾 Install

npm install @muchobien/env-cmd -D or yarn add @muchobien/env-cmd -D

⌨️ Basic Usage

Environment file ./.env

# This is a comment
ENV1=THANKS
ENV2=FOR ALL
ENV3=THE FISH

Package.json

{
  "scripts": {
    "test": "env-cmd jest"
  }
}

Terminal

yarn env-cmd node index.js
npx env-cmd node index.js

Using custom env file path

To use a custom env filename or path, pass the -f flag.

Terminal

yarn env-cmd -f ./custom/path/.env -f ./other/path/.env node index.js
npx env-cmd -f ./custom/path/.env -f ./other/path/.env node index.js

📜 Help

NAME:
   env-cmd - Load environment variables from .env file and execute commands

USAGE:
   env-cmd [global options] command [command options] [arguments...]

VERSION:
   0.0.0

COMMANDS:
   list, l  List environment variables
   help, h  Shows a list of commands or help for one command

GLOBAL OPTIONS:
   --env value, -e value [ --env value, -e value ]    Additional environment variables
   --file value, -f value [ --file value, -f value ]  Paths to env files (default: ".env")
   --help, -h                                         show help (default: false)
   --interpolate, -i                                  Interpolate environment variables in command arguments (default: false)
   --override, -o                                     Override existing environment variables with new ones (default: true)
   --prefix value, -p value                           Prefix for environment variables
   --silent, -s                                       Ignore errors if .env file is not found (default: false)
   --version, -v                                      print the version (default: false)
   --watch, -w                                        Watch for changes in .env files and reload them (default: false)

🧬 Related Projects

toddbluhm/env-cmd - Orginal project that inspired this one.