GV

GeezerVison

The World Wide Web, restored to 800 pixels of glory.

Home|About|Gaming cabinet|Archives|How it works|Starter sites

On this site

  • Sign in
  • ActionsCI/CD and automation
  • CodespacesCloud development environments
  • All Features
  • Documentation
  • Training
  • Certifications
  • Build with Copilot
  • Customize Copilot
  • Integrations
  • Trending repos
  • GitHub Sponsors
  • Developer articles
  • Enterprises

This view

  • Original page
  • New address

GeezerVison is showing github.com — GitHub - jdx/usage: A specification for CLIs

BranchesTags
Open more actions menu

Latest commit

 

History

1,641 Commits
1,641 Commits

Folders and files

NameName
Last commit message
Last commit date
.agents/skills/entire-search
.agents/skills/entire-search
 
 
.claude
.claude
 
 
.codex
.codex
 
 
.config
.config
 
 
.cursor
.cursor
 
 
.entire
.entire
 
 
.github
.github
 
 
.idea
.idea
 
 
.mise/locks/oxfmt/0.80.0
.mise/locks/oxfmt/0.80.0
 
 
argv
argv
 
 
benches
benches
 
 
clap_usage
clap_usage
 
 
cli
cli
 
 
config
config
 
 
conformance
conformance
 
 
corpus
corpus
 
 
derive
derive
 
 
docs
docs
 
 
examples
examples
 
 
go
go
 
 
integrations
integrations
 
 
lib
lib
 
 
skills/usage
skills/usage
 
 
tasks
tasks
 
 
test
test
 
 
usage-dynamic
usage-dynamic
 
 
usage-rs-tests
usage-rs-tests
 
 
usage-rs
usage-rs
 
 
validation
validation
 
 
xtask
xtask
 
 
.editorconfig
.editorconfig
 
 
.gitattributes
.gitattributes
 
 
.gitignore
.gitignore
 
 
.golangci.yml
.golangci.yml
 
 
.markdownlintignore
.markdownlintignore
 
 
.mega-linter.yml
.mega-linter.yml
 
 
.oxfmtrc.json
.oxfmtrc.json
 
 
.yamllint.yml
.yamllint.yml
 
 
AGENTS.md
AGENTS.md
 
 
CHANGELOG.md
CHANGELOG.md
 
 
CLAUDE.md
CLAUDE.md
 
 
CONTRIBUTING.md
CONTRIBUTING.md
 
 
Cargo.lock
Cargo.lock
 
 
Cargo.toml
Cargo.toml
 
 
LICENSE
LICENSE
 
 
NOTICE.md
NOTICE.md
 
 
README.md
README.md
 
 
V8.md
V8.md
 
 
aube-lock.yaml
aube-lock.yaml
 
 
cliff.toml
cliff.toml
 
 
communique.toml
communique.toml
 
 
greptile.json
greptile.json
 
 
hk.pkl
hk.pkl
 
 
mise.lock
mise.lock
 
 
mise.toml
mise.toml
 
 
package.json
package.json
 
 
tak.toml
tak.toml
 
 

Repository files navigation

Usage

Define your CLI once. Generate the tools around it.

Usage is a portable KDL specification, a command-line utility, and a Rust framework. Describe commands, flags, arguments, and settings in one place, then use that definition for parsing, help, shell completions, Markdown docs, man pages, and typed clients.

Get started · Rust framework · Spec reference · CLI reference

Your starting point How Usage fits
A new Rust CLI Derive a typed parser and exportable spec from structs and enums.
An existing CLI Export a spec from your framework, or write KDL.
A script Declare arguments in comments and let Usage parse them.
Code that calls a CLI Generate a TypeScript or Python SDK.

Rust framework

Applications can use usage-rs to derive a typed parser and a portable Usage spec from the same Rust declaration:

[dependencies]
usage-rs = { version = "6" }
use usage_rs::Cli;

#[derive(Cli)]
#[usage(bin = "example", version)]
struct App {
    /// Print more detail.
    #[usage(short = 'v', long, count)]
    verbose: u8,

    /// Files to process.
    files: Vec<String>,
}

fn main() {
    let app = App::parse();
    // app.verbose and app.files are ready to use
}

Usage has its own derive vocabulary: use #[usage(...)] on commands, fields, and value variants. See the Rust framework guide and clap migration guide for the supported mappings and intentional differences.

Standalone CLI

Choose one installation method:

# mise
mise use -g usage

# Homebrew
brew install usage

# Cargo
cargo install usage-cli --locked

The package is usage-cli; the executable is usage. Other installation options.

With a spec saved as mycli.usage.kdl:

usage lint mycli.usage.kdl
usage generate completion zsh mycli --file mycli.usage.kdl --install
usage generate markdown --file mycli.usage.kdl --out-file reference.md
usage generate manpage --file mycli.usage.kdl --out-file mycli.1

The generated shell scripts need usage at completion time. The Rust framework can also provide completions directly from your binary.

Follow the spec walkthrough for a complete example. The Go framework is a development preview and is not ready for adoption or testing.

Contributing

See CONTRIBUTING.md for development setup, checks, and generated files.

Sponsors

Sponsored by

Entire     Omacom Foundation

View all sponsors

Acknowledgements

Usage's design owes a great deal to clap. Its help output and diagnostic conventions make clap migrations familiar, while Usage's native derive attributes reflect its portable spec model. clap's license is reproduced in NOTICE.md.

License

MIT. Third-party notices are in NOTICE.md.

About

A specification for CLIs

usage.jdx.dev

Resources

Readme
MIT license

Contributing

Contributing
Activity

Stars

1.1k stars

Watchers

4 watching

Forks

64 forks
Report repository

Releases

Sponsor this project

Packages

Used by

Contributors

Languages

You are visitor 01402775 — GeezerVison does not store the pages you look up.
Best viewed with Netscape Navigator 4.7 or Internet Explorer 6 at 800×600. No cookies required.