Skip to content

feat(cli): provide shell completion scripts#477

Merged
DavisVaughan merged 8 commits into
posit-dev:mainfrom
salim-b:add-shell-completions
Mar 11, 2026
Merged

feat(cli): provide shell completion scripts#477
DavisVaughan merged 8 commits into
posit-dev:mainfrom
salim-b:add-shell-completions

Conversation

@salim-b

@salim-b salim-b commented Mar 8, 2026

Copy link
Copy Markdown
Contributor

Closes #262

This PR implements shell completion scripts as requested in #262 for Bash, Zsh, Fish, PowerShell, and Elvish.

@DavisVaughan DavisVaughan left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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

Comment thread crates/air/src/args.rs
Comment thread crates/air/src/args.rs
@salim-b

salim-b commented Mar 10, 2026

Copy link
Copy Markdown
Contributor Author

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.

We should also follow up on our Homebrew formula and tweak it so that it auto generates the completions for the user.

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. 🙂

@DavisVaughan DavisVaughan merged commit dc8b26c into posit-dev:main Mar 11, 2026
6 checks passed
@salim-b salim-b deleted the add-shell-completions branch March 11, 2026 15:03
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.

Provide shell completion scripts

2 participants