@toilal/dotx

1.0.2 • Public • Published

dotx

Bridge the gap between shell commands and dotenv .env files.

Install

npm install --global @toilal/dotx

Docs

dotx can be used to run any command with environment variable loaded from .env file.

dotx <command>

A custom .env file can be given:

dotx -f .env.test <command>

You may also set many .env files.

dotx -f .env -f .env.local <command>

later files have higher priority and will erase variables loaded from previous files

.env files can be loaded into current shell using the following trick:

eval $(dotx -o export)

You can also grab a single value

MY_VAR=$(dotx -r MY_VAR)

Usage

$ dotx --help
Options:
      --help        Show help                                          [boolean]
      --version     Show version number                                [boolean]
  -f, --files       .env files to load                                   [array]
  -o, --output      output environment variable
                      [string] [choices: "set", "export", "json", "json-pretty"]
  -r, --read-value  read value for one environment variable             [string]
  -s, --shell       execute the command in shell                       [boolean]

Package Sidebar

Install

npm i @toilal/dotx

Weekly Downloads

0

Version

1.0.2

License

MIT

Unpacked Size

41.5 kB

Total Files

15

Last publish

Collaborators

  • toilal