diff options
-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 "}" |