github jdx/usage v2.17.0
v2.17.0: Nushell Support & Cobra Integration

7 hours ago

This release adds two significant features: shell completion support for nushell users and a new Go package for generating usage specs from Cobra CLI definitions.

Highlights

Nushell Completions

usage now generates shell completions for nushell, joining bash, zsh, fish, and PowerShell as a supported shell. The implementation uses nushell's module system and @complete syntax to provide dynamic completions that call back to usage complete-word at runtime—the same approach used by the other shells.

Thanks to @abusch for contributing this! #485

Cobra (Go) Integration

A new Go package at integrations/cobra/ converts Cobra command trees into usage specs. If you have a Go CLI built with Cobra, you can now generate shell completions, markdown docs, and man pages from your existing command definitions without writing a spec by hand.

The package provides a straightforward API:

  • Generate(cmd) — returns a KDL spec string
  • GenerateJSON(cmd) — returns a JSON spec
  • GenerateToFile(cmd, path) / GenerateJSONToFile(cmd, path) — write specs to disk

It maps Cobra commands, flags (persistent and local), positional args, aliases, ValidArgs choices, hidden/deprecated markers, and more. See the Cobra integration docs for setup details. #498

Integrations Framework Tracker

The new integrations directory documents the roadmap for framework support across languages. Clap (Rust) and Cobra (Go) are implemented; Commander.js, Click, Typer, and others are planned. #497 #499

New Contributors

Don't miss a new usage release

NewReleases is sending notifications on new releases.