# @toilal/dotx

> Bridge the gap between shell commands and .env files

Latest version **1.0.2** (published 2022-03-09) · MIT license · 0 weekly downloads

## Install

```sh
npm install @toilal/dotx
pnpm add @toilal/dotx
yarn add @toilal/dotx
bun add @toilal/dotx
```

Provides the command `dotx`.

## Health

**Score 20/100 (F)** — status: abandoned.

Positive: esm support; no vulnerabilities.

Warnings: low downloads; no types.

Negative: abandoned; low maintenance score.

## Facts

| | |
|---|---|
| Version | 1.0.2 |
| Published | 2022-03-09 |
| First published | 2022-03-06 |
| Weekly downloads | 0 |
| License | MIT |
| TypeScript types | none |
| Module format | ESM + CommonJS |
| Node | >=12 |
| Dependencies | 5 |
| Unpacked size | 40.5 KB |
| Known vulnerabilities | 0 |
| Install scripts | no |
| GitHub stars | 2 |
| Author | Toilal |
| Maintainers | toilal |
| Keywords | dotenv, cli, library, shell, script, bash, sh |

## Links

- npm: https://www.npmjs.com/package/@toilal/dotx
- Repository: https://github.com/Toilal/dotx
- Homepage: https://github.com/Toilal/dotx#readme
- Issues: https://github.com/Toilal/dotx/issues
- npm.io page: https://npm.io/package/@toilal/dotx

## Dependencies (5)

- [execa](https://npm.io/package/execa.md) ^6.1.0
- [yargs](https://npm.io/package/yargs.md) ^17.3.1
- [dotenv](https://npm.io/package/dotenv.md) ^16.0.0
- [ts-pattern](https://npm.io/package/ts-pattern.md) ^3.3.5
- [dotenv-expand](https://npm.io/package/dotenv-expand.md) ^8.0.1

## Alternatives

- [jsforce](https://npm.io/package/jsforce.md) — 851.2K weekly downloads
- [react-native-qrcode-svg](https://npm.io/package/react-native-qrcode-svg.md) — 693.5K weekly downloads
- [@salesforce/plugin-data](https://npm.io/package/@salesforce/plugin-data.md) — 394.9K weekly downloads
- [@backstage/plugin-search-common](https://npm.io/package/@backstage/plugin-search-common.md) — 308.5K weekly downloads
- [@chain-registry/types](https://npm.io/package/@chain-registry/types.md) — 38.4K weekly downloads

## Recent versions

- 1.0.2 (latest) — 2022-03-09
- 1.0.1 — 2022-03-06
- 1.0.0 — 2022-03-06

## README

# dotx

Bridge the gap between shell commands and [dotenv](https://www.npmjs.com/package/dotenv) `.env` files.

## Install

```bash
npm install --global @toilal/dotx
```

## Docs

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

```bash
dotx <command>
```

A custom `.env` file can be given:

```bash
dotx -f .env.test <command>
```

You may also set many `.env` files.

```bash
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:

```bash
eval $(dotx -o export)
```

You can also grab a single value

```bash
MY_VAR=$(dotx -r MY_VAR)
```

## Usage

```bash
$ 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]
```

---
_Source: https://npm.io/package/@toilal/dotx · Machine-readable twin of the npm.io package page. Health data is recomputed on every publish._
