Skip to content

v0.1.0

Choose a tag to compare

@blaubaer blaubaer released this 15 Oct 09:28
· 32 commits to main since this release

The first release of cli4g, a Go library for typed command-line applications with extensible codecs and invocation-scoped resource management.

Highlights

  • Typed options: define flags and positional arguments through struct tags or explicit builders, and receive typed options in handlers.
  • Commands and subcommands: build nested command trees with inherited flags and typed access to parent options.
  • Predictable input handling: explicit CLI, environment, and default precedence; required inputs, aliases, short flags, and repeatable values.
  • Ordered lifecycle: resolve and validate selected options before initialization, then execute handlers from application to leaf command.
  • Managed resources: invocation-owned files and custom resources, with child-to-parent cleanup on success and returned errors, including partial initialization failures.
  • Extensible codecs: built-in support for numeric values, strings, booleans, durations, dates, date-times, files, and slices, plus adapters for custom value types.
  • Customizable help and errors: automatic help, configurable templates, and distinct handling of invalid input, cancellation, and operational failures.
  • Reusable definitions: compile an application once and create independent invocations for repeated or concurrent parsing.

Installation

Requires Go 1.27.0 or later.
go get github.com/echocat/cli4g@v0.1.0

Documentation and examples