Get only non-dev dependencies from cargo metadata?

AFAICT, the cargo metadata tool doesn't distinguish between dev and non-dev dependencies in its output. I ran:

cargo metadata --format-version 1 | jq -r ".packages[] | select(.name == \"my-crate\").dependencies[]"

...and the resulting JSON entries for a particular crate in both the [dependencies] and [dev-dependencies] sections of Cargo.toml were identical. Is there a way that I can get cargo metadata to only output one, or at least to output information that would allow me to distinguish between the two?

there's kind field, which should contain "dev" for dev-dependencies, and null for normal dependencies.

:man_facepalming: Kids, don't program tired...

1 Like