Skip to content

Add ring completions for bash, zsh and fish - #207

Merged
Shine-neko merged 2 commits into
mainfrom
feat/shell-completions
Aug 1, 2026
Merged

Add ring completions for bash, zsh and fish#207
Shine-neko merged 2 commits into
mainfrom
feat/shell-completions

Conversation

@Shine-neko

Copy link
Copy Markdown
Contributor

ring completions <bash|zsh|fish> prints a shell completion script on stdout, so <TAB> completes commands, subcommands and flags.

ring completions zsh > ~/.zsh/completions/_ring
ring deplo<TAB>             -> deployment
ring deployment <TAB>       -> list inspect delete logs events metrics health-checks
ring deployment logs -<TAB> -> -f -c --follow --tail --since --container
  • The script is generated from the CLI tree itself (extracted into build_cli()), so completions can never drift from the real commands: a new subcommand is completable with no extra work.
  • completions is dispatched before the config is loaded, so generating a script works on a machine that has never run ring init.
  • Restricted to the three shells the docs cover. clap_complete also knows elvish and powershell; accepting values the docs don't describe would put --help and the reference out of sync.
  • Completion covers command names and flags, not values: deployment IDs would require calling the API from the shell's completion hook.

Verified by loading the generated scripts into real shells, not just by generating them: the bash examples above are actual COMPREPLY output, and the zsh script loads via fpath + compinit. Syntax checked with bash -n / zsh -n. Fish is generated and covered by unit tests, but could not be loaded here (fish is not installed on the dev machine).

The second commit fixes three pre-existing clippy errors (apply.rs, container.rs, untouched since March) that -D warnings turns into failures on a newer clippy. They were blocking the pre-push hook and are unrelated to this feature.

@Shine-neko
Shine-neko merged commit 4e3e464 into main Aug 1, 2026
5 checks passed
@Shine-neko
Shine-neko deleted the feat/shell-completions branch August 1, 2026 07:51
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant