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

derive completion scripts #3

Open
JoshMcguigan opened this issue May 18, 2019 · 3 comments

Comments

Projects
None yet
3 participants
@JoshMcguigan
Copy link
Owner

commented May 18, 2019

For users of popular Rust CLI arg parsing libraries, could we implement a #[derive(ShellCompletion)] macro?

This would provide a lot of value to the Rust community by reducing the effort required to add shell completions to a Rust CLI to almost zero.

@pickfire

This comment has been minimized.

Copy link

commented May 20, 2019

An integration with clap would be cool as well.

@amitsaha

This comment has been minimized.

Copy link

commented May 26, 2019

hi @JoshMcguigan - thanks for your recent article (related to this project). I got started with it to understand bash completion and then I thought what would be cool is to be able to make a command itself also handle its own auto-completion. When using a CLI framework, our app is already aware of it's own sub-commands/commands and flags, we should be able to achieve auto-completion from the app itself. I shared some code with a specific CLI framework in Golang (spf13/cobra#867) and see what folks have to say. I imagine, you are thinking of something similar for rust ecosystem? If so, that is, if we make the program itself handle the functionality of shell completion, why do we need compgen or this project? I don't mean to question your project's goals/need, but just want to understand - since I am just getting my feet in in this area.

Thanks.

@JoshMcguigan

This comment has been minimized.

Copy link
Owner Author

commented May 26, 2019

Hi @amitsaha, thanks for the question. This project (at the moment) provides low level primitives for writing completion scripts. Something I am looking into is whether we can add functionality to derive completion scripts automatically if, for example, the user is using structopt or some other popular rust CLI framework. In this case, the user may not be aware of the low level primitives in this crate, but they would be getting used to provide completions. In short, this project at the moment is working on laying the groundwork to make it easier to do what you are describing.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.