Skip to content

Commit ce682db

Browse files
author
Arash Rasoulzadeh
committed
Revise README.md to enhance clarity and presentation. Updated the introduction with a centered description, improved the overview section, and restructured the CLI usage and examples for better readability. Added a new FAQ section addressing common user queries and streamlined the configuration rules for clarity.
1 parent 831c590 commit ce682db

1 file changed

Lines changed: 81 additions & 154 deletions

File tree

README.MD

Lines changed: 81 additions & 154 deletions
Original file line numberDiff line numberDiff line change
@@ -1,46 +1,48 @@
11
# devenv
22

3-
[![Go Build](https://github.com/arashrasoulzadeh/devenv/actions/workflows/go.yml/badge.svg)](https://github.com/arashrasoulzadeh/devenv/actions/workflows/go.yml)
4-
[![Go Report Card](https://goreportcard.com/badge/github.com/arashrasoulzadeh/devenv)](https://goreportcard.com/report/github.com/arashrasoulzadeh/devenv)
5-
[![License](https://img.shields.io/badge/license-MIT-blue.svg)](./LICENSE)
6-
[![Go Version](https://img.shields.io/badge/go-1.20%2B-blue)](https://go.dev/)
3+
<p align="center">
4+
<b>Deterministic environment configuration management — simple, predictable, and fast.</b>
5+
</p>
76

8-
---
9-
10-
> **devenv** is a CLI tool for deterministic environment configuration management using TOML-based layering, now supporting output to dotenv, YAML, and TOML formats.
7+
<p align="center">
8+
<a href="https://github.com/arashrasoulzadeh/devenv/actions/workflows/go.yml">
9+
<img src="https://github.com/arashrasoulzadeh/devenv/actions/workflows/go.yml/badge.svg" alt="Build Status">
10+
</a>
11+
<a href="https://goreportcard.com/report/github.com/arashrasoulzadeh/devenv">
12+
<img src="https://goreportcard.com/badge/github.com/arashrasoulzadeh/devenv" alt="Go Report Card">
13+
</a>
14+
<a href="./LICENSE">
15+
<img src="https://img.shields.io/badge/license-MIT-blue.svg" alt="License">
16+
</a>
17+
<a href="https://go.dev/">
18+
<img src="https://img.shields.io/badge/go-1.20%2B-blue" alt="Go Version">
19+
</a>
20+
</p>
1121

1222
---
1323

14-
## 📖 Table of Contents
15-
16-
- [Overview](#-overview)
17-
- [Installation](#-installation)
18-
- [Quick Start](#-quick-start)
19-
- [Commands](#-commands)
20-
- [Help & Version](#help--version)
21-
- [Configuration](#️-configuration)
22-
- [How It Works](#-how-it-works)
23-
- [Examples](#-examples)
24-
- [Architecture](#-architecture)
25-
- [FAQ](#-faq)
26-
- [Contributing](#-contributing)
27-
- [License](#-license)
24+
## ✨ Overview
2825

29-
---
26+
**devenv** is a modern CLI tool for managing environment configurations using a **deterministic layered model**.
3027

31-
## 🚀 Overview
28+
No duplication. No surprises. No runtime magic.
3229

33-
**devenv** solves a simple but painful problem:
30+
Define your configuration once, override per environment, and generate clean output in:
3431

35-
> Managing environment configs across dev, staging, and production without duplication or inconsistency.
32+
- `.env`
33+
- `YAML`
34+
- `TOML`
3635

37-
It introduces a **layered configuration model**:
36+
---
3837

39-
- `base` → shared defaults
40-
- `env` → overrides
41-
- deterministic merge → output file (dotenv, YAML, or TOML)
38+
## 🚀 Why devenv?
4239

43-
Now you can choose the desired output format for your config: classic `.env`, YAML, or TOML.
40+
- 🔁 Deterministic config merging
41+
- 🧩 Clean layering: `base → env`
42+
- 📦 Multiple output formats
43+
- ⚡ Fast, dependency-free CLI
44+
- 🛠 CI/CD friendly
45+
- 🧠 Zero magic — fully predictable
4446

4547
---
4648

@@ -52,16 +54,16 @@ Now you can choose the desired output format for your config: classic `.env`, YA
5254
brew install arashrasoulzadeh/tap/devenv
5355
```
5456

55-
### Manual Download
56-
57-
Grab the latest release for your OS from the [Releases page](https://github.com/arashrasoulzadeh/devenv/releases):
57+
### Manual
5858

5959
```bash
6060
curl -L https://github.com/arashrasoulzadeh/devenv/releases/latest/download/devenv-linux -o devenv
6161
chmod +x devenv
6262
sudo mv devenv /usr/local/bin/
6363
```
6464

65+
📥 Releases: https://github.com/arashrasoulzadeh/devenv/releases
66+
6567
---
6668

6769
## ⚡ Quick Start
@@ -71,7 +73,7 @@ sudo mv devenv /usr/local/bin/
7173
```toml
7274
[output]
7375
name = ".env"
74-
type = "dotenv" # can be "dotenv", "yaml", or "toml"
76+
type = "dotenv"
7577

7678
[base]
7779
app_name = "devenv"
@@ -91,23 +93,24 @@ devenv dev
9193

9294
### 3. Output
9395

94-
The output format depends on `[output.type]`:
96+
#### Dotenv
9597

96-
#### Dotenv (default)
9798
```env
9899
app_name=devenv
99100
db_host=dev.internal
100101
db_user=dev_user
101102
```
102103

103104
#### YAML
105+
104106
```yaml
105107
app_name: "devenv"
106108
db_host: "dev.internal"
107109
db_user: "dev_user"
108110
```
109111
110112
#### TOML
113+
111114
```toml
112115
app_name = "devenv"
113116
db_host = "dev.internal"
@@ -116,87 +119,38 @@ db_user = "dev_user"
116119

117120
---
118121

119-
## 🧰 Commands & CLI Usage
120-
121-
### Basic Usage
122-
123-
```
124-
devenv [environment] [flags]
125-
```
126-
127-
- `environment`: Name of the environment section to use (e.g. `dev`, `staging`, `prod`).
128-
- Flags: See below for supported flags.
129-
130-
#### Common Commands
131-
132-
| Command | Description |
133-
|------------------------|-----------------------------------------------|
134-
| `devenv dev` | Build the config for the dev environment |
135-
| `devenv staging` | Build the config for the staging environment |
136-
| `devenv prod` | Build the config for the prod environment |
137-
| `devenv help` | Show help/usage information |
138-
| `devenv version` | Print version, build date, commit info |
139-
140-
### Full CLI Help
141-
142-
You can always run:
122+
## 🧰 CLI Usage
143123

144124
```bash
145-
devenv help
125+
devenv [environment]
146126
```
147127

148-
To see CLI help and all possible usages, which prints:
149-
150-
```
151-
devenv - Deterministic Environment Configuration Manager
152-
153-
Usage:
154-
devenv [environment]
155-
156-
Description:
157-
devenv generates environment configuration files in multiple formats (dotenv, YAML, TOML)
158-
using a simple, layered TOML configuration.
159-
160-
Available Commands:
161-
help Display this help message
162-
version Show version and build information
163-
164-
Examples:
165-
devenv dev # Generate config using the 'dev' environment
166-
devenv help # Display this help message
167-
devenv version # Print version information
168-
```
169-
170-
---
171-
172-
## 🆘 Help & Version
173-
174-
### Show help
128+
### Examples
175129

176130
```bash
177-
devenv help
131+
devenv dev
132+
devenv staging
133+
devenv prod
178134
```
179135

180-
- Prints a help message with usage instructions and exits.
181-
182-
### Show version
183-
184-
```bash
185-
devenv version
186-
```
136+
### Commands
187137

188-
- Prints the current version, build date, and commit hash for debugging and support.
138+
| Command | Description |
139+
|-------------------|------------------------------|
140+
| devenv dev | Generate dev config |
141+
| devenv staging | Generate staging config |
142+
| devenv prod | Generate production config |
143+
| devenv help | Show help |
144+
| devenv version | Show version info |
189145

190146
---
191147

192148
## ⚙️ Configuration
193149

194-
### Structure
195-
196150
```toml
197151
[output]
198152
name = ".env"
199-
type = "dotenv" # can be "dotenv", "yaml", or "toml"
153+
type = "dotenv"
200154

201155
[base]
202156
# shared values
@@ -208,53 +162,50 @@ type = "dotenv" # can be "dotenv", "yaml", or "toml"
208162
# overrides
209163
```
210164

211-
---
212-
213165
### Rules
214166

215-
1. Start from `[base]`
216-
2. Apply environment override
217-
3. Override only matching keys
218-
4. Output as dotenv (`key=value`), YAML, or TOML
167+
1. Load `[base]`
168+
2. Apply environment overrides
169+
3. Merge deterministically
170+
4. Render output format
219171

220172
---
221173

222174
## 🧠 How It Works
223175

224176
```mermaid
225177
flowchart TD
226-
A[CLI Input] --> B[Load TOML]
227-
B --> C[Parse Base]
228-
C --> D[Apply Env Override]
178+
A[CLI Input] --> B[Load Config]
179+
B --> C[Base Layer]
180+
C --> D[Env Override]
229181
D --> E[Merge Engine]
230-
E --> F[Output Writer]
231-
F --> G[Output file]
182+
E --> F[Renderer]
183+
F --> G[Output File]
232184
```
233185

234-
The output format is chosen based on the `[output.type]` field in your config. Supported options: `dotenv`, `yaml`, or `toml`.
235-
(See [`app.go`](./app.go) for how output type is handled: the tool selects `ParseTOML`, `ParseDotEnv`, or `ParseYAML` accordingly.)
236-
237186
---
238187

239-
## 💡 Examples
240-
241-
### Multi-environment setup
188+
## 💡 CI/CD Example
242189

243190
```bash
244-
devenv dev
245-
devenv staging
246-
devenv prod
191+
devenv prod && export $(cat .env | xargs)
247192
```
248193

249194
---
250195

251-
### CI/CD usage
196+
## ❓ FAQ
252197

253-
```bash
254-
devenv prod && export $(cat .env | xargs)
255-
```
198+
**Missing key?**
199+
Falls back to `base`. If not found → error.
200+
201+
**Unlimited environments?**
202+
Yes.
256203

257-
*(for YAML/TOML, use the output with compatible tools or parsers in your CI pipeline)*
204+
**Deterministic?**
205+
Always.
206+
207+
**Supported formats?**
208+
dotenv, YAML, TOML
258209

259210
---
260211

@@ -271,47 +222,23 @@ flowchart LR
271222

272223
---
273224

274-
## ❓ FAQ
275-
276-
### What if a key is missing?
277-
278-
Falls back to `base`. If not found there → error.
279-
280-
### Can I add unlimited environments?
281-
282-
Yes.
283-
284-
### Is it deterministic?
285-
286-
Yes — same input always produces same output.
287-
288-
### What output formats can I use?
289-
290-
You can generate dotenv, YAML, or TOML outputs using `[output.type]`. The tool detects this and renders the correct format.
291-
292-
---
293-
294225
## 🤝 Contributing
295226

296-
PRs are welcome.
297-
298227
```bash
299228
git clone https://github.com/arashrasoulzadeh/devenv
300229
go test ./...
301230
```
302231

232+
PRs welcome.
233+
303234
---
304235

305236
## 📄 License
306237

307-
MIT © [Arash Rasoulzadeh](https://github.com/arashrasoulzadeh)
238+
MIT © Arash Rasoulzadeh
308239

309240
---
310241

311-
## Why devenv?
242+
## Star History
312243

313-
- Predictable, deterministic config layering
314-
- Choose your output: dotenv, YAML, or TOML
315-
- No runtime magic
316-
- No dependency sprawl
317-
- Just simple, portable configuration!
244+
If you like this project, give it a ⭐ on GitHub!

0 commit comments

Comments
 (0)