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

Generate shell completions as part of the build process to assist cross compilation #5562

Closed
2 tasks done
Flowdalic opened this issue Jul 2, 2024 · 2 comments
Closed
2 tasks done
Labels
A-completion Area: completion generator C-enhancement Category: Raise on the bar on expectations

Comments

@Flowdalic
Copy link

Flowdalic commented Jul 2, 2024

Please complete the following tasks

Clap Version

4.5.8

Describe your use case

Gentoo currently improves on Rust cross-compilation. However many Rust packages in Gentoo generate the shell completions files by invoking the resulting binary, which will then output the shell completion (files). Unfortunately, this approach does not work when cross-compiling, since the resulting binary will be a binary of a different architecture than the build host.

See also https://www.mail-archive.com/gentoo-dev@lists.gentoo.org/msg99709.html

Describe the solution you'd like

The shell completion files should be an output of cargo build and not of the final binary.

Alternatives, if applicable

No response

Additional Context

No response

@Flowdalic Flowdalic added the C-enhancement Category: Raise on the bar on expectations label Jul 2, 2024
@epage
Copy link
Member

epage commented Jul 5, 2024

Not to sure what is expected of clap. We document both workflows and a reason to generate completions as part of the program (rather than cargo build) is so that the completions can be generated on-demand, rather than statically, so that they "auto-update" with the program (for non-distro use cases). In fact, I'm going to be encouraging that workflow with the new completion system (#3166) as there is a tighter coupling between the completions and the users program.

@epage epage added the A-completion Area: completion generator label Jul 5, 2024
@Flowdalic
Copy link
Author

Not to sure what is expected of clap. We document both workflows

I wasn't aware that clap is already able to generate the completions as part of the build. Thanks for pointing this out!

In fact, I'm going to be encouraging that workflow

Feel free to encourage it. But with my package-maintainer hat on, there is no need for that if the application is installed via means of the Linux distribution. Because then, the completions are installed system wide via the package manager of the used Linux distribution and updated as soon as the package is updated. So, please keep the generate_to functionality, as it is relevant when packaging the application.

@epage epage closed this as not planned Won't fix, can't repro, duplicate, stale Jul 6, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
A-completion Area: completion generator C-enhancement Category: Raise on the bar on expectations
Projects
None yet
Development

No branches or pull requests

2 participants