Nabat: A CLI framework for Go with adaptive arguments, interactive prompts, and structured output
Adds adaptive argument resolution (CLI → Env → Prompt → Default) to Go CLIs. Provides a high-level API for themed, semantic, and structured output without breaking pipes.
liveNabat
TaglineA CLI framework for Go with adaptive arguments, interactive prompts, and structured output
Platformother
CategoryDeveloper Tools · CLI Frameworks · Go Library
Visitgithub.com
Source
Nabat doesn't try to reinvent the CLI wheel; instead, it recognizes that while Cobra is the industry standard for routing, it leaves the 'last mile' of user experience—styling, interactive prompts, and adaptive configuration—to the developer. By wrapping Cobra, Nabat introduces a functional options pattern that significantly cleans up the repetitive boilerplate usually associated with flag and argument definition. The standout feature is its adaptive resolution pipeline, which allows a tool to behave seamlessly whether it is running in a CI pipeline (via environment variables) or on a developer's terminal (via interactive prompts). Technically, Nabat is a heavy lifter in terms of dependencies, leaning on the Charm ecosystem (Lip Gloss, Huh, Glamour) to handle the TUI complexities. This is a calculated trade-off: you lose the 'zero-dependency' purity, but you gain a professional-grade visual suite, including twelve built-in themes and pipe-friendly semantic helpers. The framework's discipline regarding stdout vs. stderr is commendable; semantic alerts go to stderr, ensuring that the primary data stream remains clean for shell piping, a detail often overlooked in 'pretty' CLI frameworks. The binding system, utilizing Go generics and struct tags, provides a type-safe way to extract resolved values, reducing the manual casting typically required when working with pflags. However, the reliance on a large stack of dependencies may be a deterrent for those building lightweight binaries. For teams building complex internal tooling or developer-facing CLIs where UX is a priority, the productivity gains from the integrated forms and themed outputs outweigh the binary bloat. Ultimately, Nabat is for the Go developer who is tired of writing the same `if isTerminal { prompt () } else { checkEnv () }` logic. It transforms the CLI from a rigid set of flags into a flexible interface that adapts to its environment.
Article Tags
indiedeveloper toolscli frameworksgo library