Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add CLI autocompletion using clap_complete #2559

Merged
merged 1 commit into from Jun 30, 2023

Conversation

titaniumtraveler
Copy link
Contributor

I recently started using sqlx (and sqlx-cli) for a project and
noticed there is no autocompletion.

As it's trivial to add autocompletion to clap-based CLIs and I've done
it a bunch of times I would just create a pr.

How to use it

I added a subcommand named completions to generate completions on the
fly. clap_complete theoretically also supports generating completions
at compile time, but as cargo install doesn't support installing
autocompletion scripts that doesn't really make sense here.

$ sqlx completions bash > path/to/completions

clap_complete per default supports generating autocompletions for bash, elvish, fish, powershell, and zsh.

Sadly there is currently no standard way to create completions for
cargo subcommands, so cargo-sqlx can't benefit from completions.

@abonander abonander merged commit 1b7631e into launchbadge:main Jun 30, 2023
53 checks passed
@titaniumtraveler titaniumtraveler deleted the pr-complete branch July 1, 2023 13:23
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.

None yet

2 participants