clap-rs / clap

A full featured, fast Command Line Argument Parser for Rust

Home Page:docs.rs/clap

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

[clap-completions] impl Generator for dyn Generator

lolbinarycat opened this issue · comments

Please complete the following tasks

Clap Version

4.5.4

Describe your use case

being able to easily decide which shell to generate completions for at runtime without limiting yourself to only implementations of Generator found in clap-complete.

Describe the solution you'd like

add two new blanket implementations of Generator, one for &dyn Generator and one for Box<dyn Generator>.

Alternatives, if applicable

clap_complete::Shell: can't represent generators defined outside of clap-complete.

Additional Context

Generator is already object-safe, so this should be an easy change.

Could you provide a more concrete example of what you are trying to accomplish?

having an array of generators, including those provided by other crates.