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 subcommand for generating shell completion scripts #1374

Closed
wants to merge 3 commits into from

Conversation

tranzystorekk
Copy link
Contributor

@tranzystorekk tranzystorekk commented Dec 6, 2021

Since clap gives those basically for free 😄

@lpil
Copy link
Member

lpil commented Dec 6, 2021

Very cool! How do we use it?

@tranzystorekk
Copy link
Contributor Author

tranzystorekk commented Dec 6, 2021

@lpil depends on shell, but basically for example gleam completion zsh > <completion_dir>/_gleam, usually package maintainers put them in global completion paths like /usr/share/bash-completion/completions/ or /usr/share/zsh/site-functions/ for Arch

@tranzystorekk
Copy link
Contributor Author

A user typically configures a local completion directory and adds it to an env var like FPATH in zsh

@tranzystorekk
Copy link
Contributor Author

Ugh, seems AppSettings::Hidden doesn't hide commands from the completion generator

obraz

@lpil
Copy link
Member

lpil commented Dec 6, 2021

Hmm, that is a bit annoying. It could be OK if we remove the print-config command.

Perhaps newer versions of clap might hide them? It seems odd they are not hidden. It would be frustrating in future if we wanted to hide something more substantial than print-config

@tranzystorekk
Copy link
Contributor Author

tranzystorekk commented Dec 7, 2021

Perhaps newer versions of clap might hide them?

Did a quick check on clap 3.0.0-beta.5 for my own project, hidden apps still show up in scripts 🙁

EDIT: The issue has been there for a while: clap-rs/clap#1335

@lpil
Copy link
Member

lpil commented Dec 9, 2021

It looks like it will be fixed in a future release? clap-rs/clap#2541

@tranzystorekk
Copy link
Contributor Author

tranzystorekk commented Dec 10, 2021

From the discussion it seems the status is back to clap-rs/clap#1335

@lpil
Copy link
Member

lpil commented Dec 11, 2021

Ah, that is a shame

@lpil
Copy link
Member

lpil commented Jan 16, 2022

I'm going to close this as we're a bit stuck, but please feel free to reopen once we can hide commands.

@lpil lpil closed this Jan 16, 2022
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.

2 participants