epage / clapng

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

Auto-generated completion scripts add `NuShell` support #207

Open epage opened 2 years ago

epage commented 2 years ago

Issue by hustcer Monday Sep 20, 2021 at 00:22 GMT Originally opened as https://github.com/clap-rs/clap/issues/2778


Please complete the following tasks

Clap Version

3.0.0-beta.4

Describe your use case

Auto-generated completion scripts add NuShell support

Describe the solution you'd like

Auto-generated completion scripts add NuShell support, just as clap support (Bash, Zsh, Fish, Elvish and PowerShell), Thx

Alternatives, if applicable

No response

Additional Context

nu --version
───┬────────────────────┬────────────────────────────────────────────────────────────────────────────────────
 # │      Column0       │                                      Column1
───┼────────────────────┼────────────────────────────────────────────────────────────────────────────────────
 0 │ version            │ 0.37.0
 1 │ build_os           │ macos-x86_64
 2 │ rust_version       │ rustc 1.55.0
 3 │ cargo_version      │ cargo 1.55.0
 4 │ pkg_version        │ 0.37.0
 5 │ build_time         │ 2021-09-14 19:45:30 +00:00
 6 │ build_rust_channel │ release
 7 │ features           │ clipboard-cli, ctrlc, dataframe, default, rustyline, term, trash, uuid, which, zip
 8 │ installed_plugins  │
───┴────────────────────┴────────────────────────────────────────────────────────────────────────────────────
epage commented 2 years ago

Comment by epage Monday Sep 20, 2021 at 17:01 GMT


Somewhat unrelated but I wonder what the code size / compile time looks like for all of our generators and if there is anything we can help developers with development time as our generators expand in number of targets and capabilities.

epage commented 2 years ago

Comment by pksunkara Monday Sep 20, 2021 at 21:09 GMT


That was the intention for extra generators. For the basic common ones, we have them in the package itself, but if we were to implement this, we would create a new package called clap_generator_nushell or something.

One thing I am not sure if we can do in Rust because of these new const stuff is, can a user extend the Shell enum through 3rd party code (traits)?

epage commented 2 years ago

Comment by epage Monday Sep 20, 2021 at 21:27 GMT


A user could manually impl ArgEnum and flatten Shell into their enum or we could add flatten support but I'm not aware of a language feature that would help.