docs(README): update architecture diagram and enhance CLI/API tables for clarity

This commit is contained in:
2026-05-02 14:19:27 +01:00
parent c575341178
commit 327bdfe9ff
+5 -5
View File
@@ -10,7 +10,7 @@ Convert **env**, **YAML**, **JSON**, and **INI** to and from Go `map[string]any`
## Architecture ## Architecture
```mermaid ```mermaid
flowchart LR flowchart TB
Sources["Sources\nbytes reader file URL process env"] Sources["Sources\nbytes reader file URL process env"]
Parser["Parser\ngodotenv yaml ini json"] Parser["Parser\ngodotenv yaml ini json"]
Norm["keymap.Walk\nNormalizer"] Norm["keymap.Walk\nNormalizer"]
@@ -85,7 +85,7 @@ os.WriteFile("out.json", b, 0o644)
## CLI: `envc` ## CLI: `envc`
| Command | Purpose | | Command | Purpose |
| --- | --- | | ------------------------------------------------------------------ | --------------------------------------------------------------- |
| `envc convert --from yaml --to env --input - --output -` | Convert stdin YAML to dotenv on stdout | | `envc convert --from yaml --to env --input - --output -` | Convert stdin YAML to dotenv on stdout |
| `envc get --from yaml --path service.name config.yaml` | Print one path (dot-separated; segments normalized like codecs) | | `envc get --from yaml --path service.name config.yaml` | Print one path (dot-separated; segments normalized like codecs) |
| `envc merge --from yaml --to json --output out.json a.yaml b.yaml` | Deep-merge multiple YAML files, emit JSON | | `envc merge --from yaml --to json --output out.json a.yaml b.yaml` | Deep-merge multiple YAML files, emit JSON |
@@ -93,7 +93,7 @@ os.WriteFile("out.json", b, 0o644)
## API (all codecs) ## API (all codecs)
| Method | Description | | Method | Description |
| --- | --- | | ----------------------------------------------- | --------------------------------- |
| `New(opts...)` | Construct codec | | `New(opts...)` | Construct codec |
| `Map(ctx)` | Merged `map[string]any` | | `Map(ctx)` | Merged `map[string]any` |
| `Unmarshal(dst)` / `UnmarshalContext(ctx, dst)` | Decode into struct (or map) | | `Unmarshal(dst)` / `UnmarshalContext(ctx, dst)` | Decode into struct (or map) |
@@ -106,7 +106,7 @@ Shared options (each subpackage): `WithBytes`, `WithReader`, `WithFile`, `WithUR
## Cross-format mapping ## Cross-format mapping
| Go | YAML | ENV | | Go | YAML | ENV |
| --- | --- | --- | | ------------------------- | -------------------------- | ------------------------- |
| `Service.SubService.Name` | `service.sub-service.name` | `SERVICE_SUBSERVICE_NAME` | | `Service.SubService.Name` | `service.sub-service.name` | `SERVICE_SUBSERVICE_NAME` |
INI uses dotted sections, e.g. `[service.subservice]` with `name=...`. INI uses dotted sections, e.g. `[service.subservice]` with `name=...`.
@@ -114,7 +114,7 @@ INI uses dotted sections, e.g. `[service.subservice]` with `name=...`.
## Related libraries ## Related libraries
| Module | Role | | Module | Role |
| --- | --- | | --------------------------------------------------------- | -------------- |
| [go-matrix-bot](https://github.com/eSlider/go-matrix-bot) | Matrix bots | | [go-matrix-bot](https://github.com/eSlider/go-matrix-bot) | Matrix bots |
| [go-onlyoffice](https://github.com/eSlider/go-onlyoffice) | OnlyOffice API | | [go-onlyoffice](https://github.com/eSlider/go-onlyoffice) | OnlyOffice API |
| [go-ollama](https://github.com/eSlider/go-ollama) | Ollama client | | [go-ollama](https://github.com/eSlider/go-ollama) | Ollama client |