Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/muchobien/env-cmd
A simple program for executing commands using an environment from an env file.
https://github.com/muchobien/env-cmd
command-line-tool cross-platform env-cmd enviroment-variables environment nodejs utilities variables
Last synced: 3 days ago
JSON representation
A simple program for executing commands using an environment from an env file.
- Host: GitHub
- URL: https://github.com/muchobien/env-cmd
- Owner: muchobien
- License: mit
- Created: 2022-08-19T00:46:45.000Z (about 2 years ago)
- Default Branch: main
- Last Pushed: 2023-03-06T22:12:35.000Z (over 1 year ago)
- Last Synced: 2024-10-28T14:17:56.154Z (17 days ago)
- Topics: command-line-tool, cross-platform, env-cmd, enviroment-variables, environment, nodejs, utilities, variables
- Language: Go
- Homepage:
- Size: 109 KB
- Stars: 1
- Watchers: 1
- Forks: 0
- Open Issues: 7
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# 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`**
```text
# This is a comment
ENV1=THANKS
ENV2=FOR ALL
ENV3=THE FISH
```**Package.json**
```json
{
"scripts": {
"test": "env-cmd jest"
}
}
```**Terminal**
```sh
yarn env-cmd node index.js
``````sh
npx env-cmd node index.js
```### Using custom env file path
To use a custom env filename or path, pass the `-f` flag.
**Terminal**
```sh
yarn env-cmd -f ./custom/path/.env -f ./other/path/.env node index.js
``````sh
npx env-cmd -f ./custom/path/.env -f ./other/path/.env node index.js
```## 📜 Help
```text
NAME:
env-cmd - Load environment variables from .env file and execute commandsUSAGE:
env-cmd [global options] command [command options] [arguments...]VERSION:
0.0.0COMMANDS:
list, l List environment variables
help, h Shows a list of commands or help for one commandGLOBAL 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`](https://github.com/toddbluhm/env-cmd) - Orginal project that inspired this one.