feat(cli): provide shell completion scripts#477
Conversation
So we get completions and the standardized `[possible values: <enum>]` docs
There was a problem hiding this comment.
This is looking very nice! I've tweaked it a bit to align more with what ruff does for some ecosystem consistency, added more tests, and tweaked LogLevel so we get completions for its variants.
It's now a hidden top level command of air generate-shell-completion <shell>, which is what ruff does as well to avoid top level namespace pollution in the help output for such a rarely used function.
We should also follow up on our Homebrew formula and tweak it so that it auto generates the completions for the user. I think that is pretty easy to do if we copy ruff:
https://github.com/Homebrew/homebrew-core/blob/b0aa782cf352742b2a1d2add52e6a38aad19b6d9/Formula/r/ruff.rb#L22
Screen.Recording.2026-03-10.at.2.57.11.PM.mov
|
Perfect! Thanks for the feedback and going ahead and implementing the desired changes. I'm fine with either subcommand name and all the other changes totally make sense.
I decided to give implementing shell completions a shot when I submitted air to conda-forge (still pending) and rediscovered my own issue 😄 I'll surely add shell completions support to the conda-forge recipe once this is released. I'm not too familiar with brew, so I would certainly leave it to you first to file a PR. 🙂 |
Closes #262
This PR implements shell completion scripts as requested in #262 for Bash, Zsh, Fish, PowerShell, and Elvish.