Metadata-Version: 2.4
Name: env-differ
Version: 0.1.0
Summary: CLI tool to compare two .env files and report differences
License: MIT
Keywords: dotenv,env,diff,cli,devops
Classifier: Development Status :: 4 - Beta
Classifier: Environment :: Console
Classifier: Intended Audience :: Developers
Classifier: License :: OSI Approved :: MIT License
Classifier: Programming Language :: Python :: 3
Classifier: Programming Language :: Python :: 3.11
Classifier: Programming Language :: Python :: 3.12
Classifier: Topic :: Software Development :: Libraries :: Python Modules
Classifier: Topic :: Utilities
Requires-Python: >=3.11
Description-Content-Type: text/markdown
Requires-Dist: click>=8.1
Requires-Dist: rich>=13.0
Provides-Extra: dev
Requires-Dist: pytest>=8.0; extra == "dev"
Requires-Dist: pytest-cov>=5.0; extra == "dev"

# env-differ

![Tests](https://github.com/your-org/env-differ/actions/workflows/test.yml/badge.svg)
![PyPI](https://img.shields.io/pypi/v/env-differ)
![Python](https://img.shields.io/pypi/pyversions/env-differ)

A CLI tool that compares two `.env` files and reports differences — missing keys, extra keys, and changed values.  
Values are **never printed**; only key names are shown.

---

## Installation

```bash
pip install env-differ
```

Or install from source for development:

```bash
git clone https://github.com/your-org/env-differ.git
cd env-differ
pip install -e ".[dev]"
```

---

## Usage

```bash
env-differ <file_a> <file_b>
```

`file_a` is the **reference** file (e.g. `.env.example`).  
`file_b` is the file being checked (e.g. `.env`).

### Basic comparison

```bash
env-differ .env.example .env
```

Output example:

```
Missing keys (in .env.example but not in .env):
  - DATABASE_URL
  - SECRET_KEY

Extra keys (in .env but not in .env.example):
  + DEBUG_VERBOSE

Changed values (key exists in both files but values differ):
  ~ APP_ENV [CHANGED]
```

### No differences

```
All good! No differences found.
```

### --strict (CI mode)

Exit with code `1` if any **missing keys** are found. Useful in CI pipelines to ensure a `.env` file has all required keys from the example.

```bash
env-differ --strict .env.example .env
echo $?   # 1 if missing keys, 0 otherwise
```

GitHub Actions example:

```yaml
- name: Check .env completeness
  run: env-differ --strict .env.example .env
```

### --json (machine-readable output)

```bash
env-differ --json .env.example .env
```

Output:

```json
{
  "missing": ["DATABASE_URL", "SECRET_KEY"],
  "extra": ["DEBUG_VERBOSE"],
  "changed": ["APP_ENV"],
  "has_differences": true
}
```

### --version

```bash
env-differ --version
```

### Help

```bash
env-differ --help
env-differ -h
```

---

## Behaviour notes

- Lines starting with `#` and blank lines are ignored.
- `export KEY=VALUE` syntax is supported.
- Surrounding single or double quotes are stripped from values.
- Actual values are **never** shown in output (privacy-safe).

---

## Running tests

```bash
pytest
```

With coverage:

```bash
pytest --cov=env_differ --cov-report=term-missing
```

---

## License

MIT
