Skip to content

Instantly share code, notes, and snippets.

@gabrielfalcao
Last active May 3, 2026 00:52
Show Gist options
  • Select an option

  • Save gabrielfalcao/40cb4364fcf356d3ffcfa7f0279da1eb to your computer and use it in GitHub Desktop.

Select an option

Save gabrielfalcao/40cb4364fcf356d3ffcfa7f0279da1eb to your computer and use it in GitHub Desktop.
Using the wonderful tool "jaq" to perform "jq-like" operatoins in a Cargo.lock file

do youself a solid and replace jq with jaq

WHY?

Because jaq functions the same as jq while supporting the same feature set for yaml, toml and many other serialization formats which makes it awesome.

And because jaq's author is a badass computer scientist.

declare -g jq_location=$(which jq)
brew uninstall jq
brew install jaq
[ -n "${jq_location}" ] && ln -s $(which jaq) "${jq_location}"
cat Cargo.lock \
| jaq -r --from toml '.package[] |
.name as $name |
select(.dependencies != null) |
.dependencies[] |
{package:$name, depends_on:.}' | jaq -s
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment