-
-
Notifications
You must be signed in to change notification settings - Fork 1.1k
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
Deprecate Yaml API #3087
Comments
Deprecated in 6ce9714 |
Why do all the comments in the code say "deprecated in issue #9" when that issue has nothing to do with YAML or deprecation? |
I missed updating those references. There was work being done in another org for a short period of time. I'll go update those. |
These exist pretty much just for YAML (clap-rs#3087). If anyone else is building on these, it has a limited shelf-life anyways because of clap-rs#2717. BREAKING CHANGE: `FromStr` for settings requires the `yaml` feature.
Hi, I'm an avid YAML user and am really disappointed that YAML is getting deprecated! The YAML configuration positives outweigh the negatives for me greatly:
I'm all for easy to use, clean and readable code and this is what the YAML configuration provided for me. Yes, there are a bunch of downsides, but I'm fine with them for the above reasons. Even though I'm just one developer that uses clap in my own projects (e. g. Dekinai) I hope that you will reconsider supporting YAML in future clap versions. 👍 |
Are you loading the yaml file at compile time or runtime? The latter offers the faster iteration while the former keeps single-file binaries. Just wanting to better understand how much faster iteration you are getting.
What are your thoughts on the Derive API? I feel like it similarly accomplishes these. I am interested in hearing more about in which ways you appreciate yaml helping separate clap / app logic and why it is important. I can make guesses as to what you are referring to but would rather hear what you are actually aiming for than living with assumptions :).`
Would you be willing to help maintain a |
With fast iterations I actually meant being able to iterate through changes (try out changes) very quickly during development. I'm not too concerned about any performance hits that clap would cause, because these would only affect application start time. I'm using the
I've looked through this documentation and also some examples and I would not use it. My goal is to not clutter This is what bugs me about the Derive API:
I like it because:
let matches = App::from(load_yaml!("cli.yaml")).get_matches();
I over-simplified the last argument, a lot of the times you still have to do checks afterwards (e. g. if you have a directory argument you might need to check if the directory exists), but you have to do these checks with all of the other methods of loading
Unfortunately no. I personally do not want to be a maintainer of public crates. Sorry! I hope this was enough to answer all of your questions. Maybe it's best if you wait for other people to chime in once everyone gets wind of this change. 😄 I just got here early because I use the |
YAML was nice to have. I use it too. It helped me separate out the CLI boilerplate from the main code. I am disappointed to see it go :( |
I think it works well as a separate component... I always thought it overkill to have it as part of clap. |
@tshepang Well it is behind an optional feature flag in v3 (not part of default features), so you usually wouldn't compile it unless you specifically included it. |
why not |
Because I do not want to do it. It's that simple. No excuses here. 😜 |
I also liked yaml way of parsing the cli arguments and have you main logic only in .rs file. It was so convenient to read and quickly add a new subcommand and args, even the person do not have much knowledge of rust code can do it . Very disappointed to see that its support is discontinued :( Probably i would like to maintain it as separate crate if i see there are avid users of it like me :) |
Is there any decent crate released for clap with yaml yet? Also, how would you use the clap::Parser trait to parse and run a yaml file for your clap app |
The most I've seen is @MitaliBo posting right before you expressing interest in starting such a crate. btw something that might be of interest is rustdoc's unstable json output could possibly be used to help seed some code-gen for a yaml parser which could help in keeping yaml support up-to-date. The main problem with it at the moment is it panics on clap, see crate-ci/cargo-crate-api#3.
At the moment, there is no integration between |
Besides all previous very important points: reduce boilerplate code, easy to read/maintain all command-line options meta info in one clear Without programmatic API to get meta info from |
You can also read metadata from a |
Just noticed that tauri has its own serde api on top of clap. While not the most efficient design (serializes into structs . and then uses the builder), it might be a good starting point for generalizing the API. Seems to be using fairly standard licenses. |
I understand the reasoning, but doing an impactful change like deprecating an entire feature with a one day comment period right at the end of a beta before release is quite painful for users :( for future versions could large changes like that be at least announced early on in the beta/RC candidate phase it'd make it easier to deal with for users. |
I would be more sympathetic if this was a removal, but it is a mere deprecation, something that also acts as an honest indicator of where things stand... doing otherwise would be misleading. I also think maintainers should be allowed to break beta releases at any time, and I don't think the deprecation was done 'late' deliberately. |
A couple of points
|
Ja, I got that wrong two things overlapped |
The Clap YAML API was deprecated, see: clap-rs/clap#3087 We should move to the Parser API instead, even though YAML was nice... to be done later on. Also pin to latest GStreamer stable releases. Using git snapshots shouldn't be needed, unless we need un-released fixes.
The Clap YAML API was deprecated, see: clap-rs/clap#3087 We should move to the Parser API instead, even though YAML was nice... to be done later on. Also pin to latest GStreamer stable releases. Using git snapshots shouldn't be needed, unless we need un-released fixes.
I made a crate for deserializing clap. https://crates.io/crates/clap-serde |
Sounds great! I tried to look into the details but it looks like the repo link is broken. |
Oh I forgot it to make it public... |
@aobatact I've done a quick pass over it and noted some things. I've also
Once you feel its in a good enough state, we can raise the visibility further, like linking to it from the README/docs.rs |
The YAML API is used for:
flatten
However, this API
If users want to keep the YAML API alive, a suggested path forward
See also https://github.com/aobatact/clap-serde
The text was updated successfully, but these errors were encountered: