Skip to content

Using Cargo metadata query information about the project

Posted on:October 24, 2024

The cargo metadata command returns the metadata for the project in JSON form. Using jq you can easily extract the details. The following command extracts the version of a package in the project.

cargo metadata --format-version 1 | jq '.packages | map(select(.name == <"package-name">)) | .[0].version'