# https://usage.jdx.dev/ llms-full.txt <|firecrawl-page-1-lllmstxt|> ## CLI Usage Specifications [Skip to content](https://usage.jdx.dev/#VPContent) # Usage A specification for CLIs [Usage Specification](https://usage.jdx.dev/spec/) [Usage CLI](https://usage.jdx.dev/cli/) ## Shell completions Generate shell completions for any shell ## Documentation Generate --help docs, markdown, and manpage documentation ## Scripts Write scripts in bash or any other language with modern arg parsing, help, and completions <|firecrawl-page-2-lllmstxt|> ## Shell Completion Scripts [Skip to content](https://usage.jdx.dev/cli/completions#VPContent) On this page # Generating Completion Scripts [​](https://usage.jdx.dev/cli/completions\#generating-completion-scripts) Usage can generate completion scripts for any shell. Here is an example for bash: bash ``` usage g completion bash mycli -f ./mycli.usage.kdl > ~/.bash_completions/mycli.bash source ~/.bash_completions/mycli.bash mycli -- ``` zsh: bash ``` usage g completion zsh mycli -f ./mycli.usage.kdl > ~/.zsh_completions/_mycli source ~/.zsh_completions/_mycli mycli -- ``` fish: bash ``` usage g completion fish mycli -f ./mycli.usage.kdl > ~/.config/fish/completions/mycli.fish mycli -- ``` fig/Amazon Q: bash ``` usage g fig -f ./mycli.usage.kdl > ./mycli.fig.ts mycli -- ``` INFO Usage CLI is a runtime dependency for the generated completion scripts. Your users will need to have `usage` installed in order for the completion scripts to work. New shells should be easy to add because the logic around completions is mostly handled by the Usage CLI. Typically, completion scripts will call usage like this to fetch completion choices (cword is the index of the current word): bash ``` $ usage complete-word --file ./mycli.usage.kdl -- mycli cmd1 cmd2 --f --force --file ``` ## Completions for `usage` CLI itself [​](https://usage.jdx.dev/cli/completions\#completions-for-usage-cli-itself) Completions for the `usage` CLI itself can be generated with one of the following commands: bash ``` usage --completions bash > /etc/bash_completion.d/usage usage --completions zsh > /usr/share/zsh/site-functions/_usage usage --completions fish > ~/.config/fish/completions/usage.fish ``` <|firecrawl-page-3-lllmstxt|> ## CLI Installation Guide [Skip to content](https://usage.jdx.dev/cli/#VPContent) On this page # CLI [​](https://usage.jdx.dev/cli/\#cli) ## Installation [​](https://usage.jdx.dev/cli/\#installation) ### [mise-en-place](https://mise.jdx.dev/) [​](https://usage.jdx.dev/cli/\#mise-en-place) sh ``` mise use -g usage ``` ### Cargo [​](https://usage.jdx.dev/cli/\#cargo) sh ``` cargo install usage-cli ``` You can also use [`cargo-binstall`](https://github.com/cargo-bins/cargo-binstall) to install quicker: sh ``` cargo binstall usage-cli ``` ### Homebrew [​](https://usage.jdx.dev/cli/\#homebrew) sh ``` brew install usage ``` ### Arch Linux [​](https://usage.jdx.dev/cli/\#arch-linux) usage is available in [Extra](https://archlinux.org/packages/extra/x86_64/usage/) sh ``` pacman -S usage ``` <|firecrawl-page-4-lllmstxt|> ## Generating Manpages [Skip to content](https://usage.jdx.dev/cli/manpages#VPContent) Return to top # Generating Manpages [​](https://usage.jdx.dev/cli/manpages\#generating-manpages) Usage CLI can generate manpages from a Usage definition. Here is an example: bash ``` $ usage g manpage -f ./mycli.usage.kdl > /usr/share/man/man1/mycli.1 $ man mycli mycli(1) General Commands Manual mycli(1) NAME mycli - description SYNOPSIS mycli [-h|--help] [-V|--version] DESCRIPTION ... OPTIONS -h, --help Print help (see a summary with '-h') ... ``` <|firecrawl-page-5-lllmstxt|> ## Markdown Documentation Generation [Skip to content](https://usage.jdx.dev/cli/markdown#VPContent) Return to top # Generating Markdown Documentation [​](https://usage.jdx.dev/cli/markdown\#generating-markdown-documentation) Usage CLI can generate markdown documentation from a Usage definition either into a single file, or a directory. Single file (will be injected in the comment): sh ``` $ cat < ./README.md # My CLI ## Header ... ## CLI Commands ## Footer ... EOF $ usage g markdown -f ./mycli.usage.kdl --inject README.md $ cat README.md # My CLI ## Header ## CLI Commands ### `mycli config add KEY VALUE` ### `mycli config remove NAME` ## Footer ``` Multiple files: sh ``` $ usage g markdown -mf ./mycli.usage.kdl --out-dir ./docs $ tree ./docs docs ├── config │ ├── add.md │ ├── list.md │ └── remove.md ├── index.md └── update.md ``` <|firecrawl-page-6-lllmstxt|> ## Bash Script Usage [Skip to content](https://usage.jdx.dev/cli/reference/bash#VPContent) On this page # `usage bash` [​](https://usage.jdx.dev/cli/reference/bash\#usage-bash) - **Usage**: `usage bash [-h] [--help]