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

[modular] User-driven validation #235

Open epage opened 2 years ago

epage commented 2 years ago

Issue by epage Tuesday Nov 09, 2021 at 14:38 GMT Originally opened as https://github.com/clap-rs/clap/issues/3008


Please complete the following tasks

Clap Version

master

Describe your use case

Describe the solution you'd like

Define one or more App Validation trait

Steps

  1. Refactor all requires, conflicts, etc APIs to be implemented in terms of this
  2. Expose the trait and structs to the user in a clap::validate
  3. Deprecate the old Arg functions so now only those using this API pay the cost due to dead code elimination

Alternatives, if applicable

No response

Additional Context

See also https://github.com/clap-rs/clap/discussions/2832

Risks are usability and performance. The most basic APIs, like required, we probably need to keep baked in. Its the special inter-arg interactions that we should be focusing on.