diff options
author | Tom Smeding <tom.smeding@gmail.com> | 2020-05-04 21:30:37 +0200 |
---|---|---|
committer | Tom Smeding <tom.smeding@gmail.com> | 2020-05-04 21:30:52 +0200 |
commit | 194f940558b494abdb16a42774ade8529f691d0f (patch) | |
tree | cfd88b146acaf70d09b5667a466e0b16dd428647 | |
parent | 154d0def16256fcb0ee861ec7a47fda7aecd9d91 (diff) |
-rwxr-xr-x | cargo-dot | 9 |
1 files changed, 8 insertions, 1 deletions
@@ -1,4 +1,11 @@ #!/usr/bin/env bash +JQ="$(command -v jq)" +if [[ $? -ne 0 ]]; then + echo >&2 "jq not found, please install jq" + exit 1 +fi + echo "digraph G {" -cargo metadata --format-version=1 | jq -r '.packages[] | "\"" + .id[0:.id|index(" ")] + "\" -> \"" + .dependencies[].name + "\";"' +cargo metadata --format-version=1 | + "$JQ" -r '.packages[] | "\"" + .id[0:.id|index(" ")] + "\" -> \"" + .dependencies[].name + "\";"' echo "}" |