clap-rs / clap

A full featured, fast Command Line Argument Parser for Rust
docs.rs/clap
Apache License 2.0
13.64k stars 1.02k forks source link

[clap-completions] impl Generator for dyn Generator #5502

Open lolbinarycat opened 1 month ago

lolbinarycat commented 1 month ago

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.

epage commented 3 weeks ago

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

lolbinarycat commented 3 weeks ago

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