Building a CLI with go-tool-base, part 2: configuration your tool can trust
Configuration for a Go CLI: precedence of flags over env over files, per-command embedded defaults, layered config merging and a strict mode.

Configuration for a Go CLI: precedence of flags over env over files, per-command embedded defaults, layered config merging and a strict mode.

Install gtb, scaffold a releasable Go project, understand the generated and owned file split, then add your first command and run it.

Why a clap global flag stops working inside a passthrough subtree: the tokens get captured as trailing args before the flag is ever parsed.

Rust has no init or pre-main phase, so self-registering commands need another mechanism. Using a distributed slice to get the same shape.

A sibling to go-tool-base rather than a port, filling the gap between excellent Rust crates and a coherent way to assemble them.

Credential storage for a Go CLI: an env-var reference by default, an opt-in OS keychain, and plaintext only as a last resort and banned in CI.

Opt-in telemetry for a command-line tool: off until someone says yes, no personal data, a pluggable backend, and a consent flow that meets GDPR.

The other audience for a CLI is the script that greps its output and breaks. Giving every command a JSON output mode with one response envelope.

Timing, auth, recovery and logging are cross-cutting in a CLI too. Wrapping Cobra commands in web-style middleware rather than PreRun hooks.

go-tool-base keeps an entire CLI command tree in one manifest file and generates the wiring from it, without locking you out of hand-written Go.
