Created
June 17, 2022 20:12
-
-
Save conradludgate/5b2f639ba897c87ed59ba5edf621cde3 to your computer and use it in GitHub Desktop.
Interactive cargo-vet
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
inspect() { | |
local name="$1" | |
local from="$2" | |
local to="$3" | |
if [ "$from" = "0.0.0" ] | |
then | |
cargo vet inspect "$name" "$to" | |
else | |
cargo vet diff "$name" "$from" "$to" | |
fi | |
cargo vet certify "$name" "$to" | |
} | |
suggest_one() { | |
suggest=$(cargo vet --output-format json suggest) | |
suggestion=$(echo "$suggest" | jq ".suggest.suggest_by_criteria[\"$1\"][0]") | |
name=$(echo "$suggestion" | jq -r ".name") | |
from=$(echo "$suggestion" | jq -r ".suggested_diff.from") | |
to=$(echo "$suggestion" | jq -r ".suggested_diff.to") | |
read -p "Inspect $name $to? [Y]es/[N]o: " -n 1 process | |
case "$process" in | |
n|N) | |
return 1 | |
;; | |
*) | |
inspect "$name" "$from" "$to" | |
;; | |
esac | |
} | |
while : | |
do | |
if ! suggest_one $1 | |
then | |
exit 0 | |
fi | |
done |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment