Can't see all available crate features from CLI anymore?

Previously if I wanted to view a list of all available crate features I could just do cargo add <crate> -F a and it'd say "that's not a valid feature, here's a list of available crate features", but it isn't doing that anymore? Is there a way to get that behavior back or do I have to open my browser every time I wanna see what features a crate has?

You can use cargo add --dry-run <crate>, or the equivalent cargo add -n <crate>. If you need it for a script, then use the following APi endpoint instead:

curl https://crates.io/api/v1/crates/<crate> | jq '.versions[0].features'

There is also a tool to get various infos about a crate: cargo install cargo-information and then cargo info <crate>.

Thanks!

This topic was automatically closed 90 days after the last reply. We invite you to open a new topic if you have further questions or comments.