Skip to content

v0.4.0

Choose a tag to compare

@github-actions github-actions released this 30 Oct 23:35
Immutable release. Only release title and notes can be modified.
db0d406

CONGA v0.4.0 wraps help to the terminal width, adds oneof flag groups and short flags for the built-in help and version flags, and names completion environment variables after the application.

🚀 Highlights

  • Help wrapping: Help output wraps to COLUMNS, the terminal width, or 100 columns, and aligns columns by terminal cell width (#88).
  • oneof flag groups: Exactly one member of a oneof group must be set. Usage shows the group as (--input-file=PATH | --input-url=URL), and completion hides the other members once one is given (#88).
  • Built-in short flags: App.HelpShortFlag and App.VersionShortFlag bind a short rune to --help and --version (#88).
  • App-named completion variables: Completion toggles are read from <APP>_COMPLETION_*, and conga.CompletionEnvPrefix overrides the prefix (#82).

⚠ Breaking Changes & Migration

API changes

  • WhyJSON and RegisterTypeOption renamed (#84):
    • Replace conga.WhyJSON() with conga.WhyOptionJSON() and the conga.RegisterTypeOption type with conga.RegistrationOption.

Schema & startup guards

  • RequiredFlag rejects default and xor (#88):
    • Either tag on a RequiredFlag fails schema build with ErrSchema. Use OptionalFlag fields in a oneof group instead.
  • conga directives removed (#88):
    • conga:"ignore" and conga:"-" no longer exclude a field. Plain fields that are not containers need no tag. Remove from the struct any container field CONGA should skip.
    • Any remaining conga tag is an unknown tag and fails schema build with ErrSchema unless allowed with app.AllowTags("conga").

Configuration

  • Completion environment variables named after the application (#82, closes #81):
    • CONGA_COMPLETION_ALIASES and CONGA_COMPLETION_DESCRIPTIONS are now <APP>_COMPLETION_ALIASES and <APP>_COMPLETION_DESCRIPTIONS, where <APP> is the application name in upper snake case. Rename them in shell configuration, or pass conga.CompletionEnvPrefix(...) to EnableCompletion to choose the prefix.

✨ Features

  • cli: Wrap help output to the terminal width and align tables by terminal cell width (#88).
  • cli: Add oneof groups for exactly-one flag sets (#88).
  • cli: Add App.HelpShortFlag and App.VersionShortFlag for built-in short flags; collisions with declared shorts fail schema build (#88).
  • cli: Help, usage, and version output use the configured application name instead of the invoked binary name (#88).
  • completion: Read completion toggles from application-prefixed variables and add conga.CompletionEnvPrefix (#82, closes #81).
  • completion: Offer flags only after - in every shell, not at a bare space; set <APP>_COMPLETION_BARE_SPACE_FLAGS or the bare-space-flags zstyle to restore them. Zsh also resolves ~name named directories (#86).

Full Changelog: v0.3.0...v0.4.0

Requirements: Go 1.27+ · Docs · pkg.go.dev