github.com/keltia/go-ipfs@v0.3.8-0.20150909044612-210793031c63/test/bin/ipfs-pin-stat (about) 1 #!/bin/sh 2 3 die() { 4 echo "$@" 5 exit 1 6 } 7 8 if [ "$#" -eq 0 ]; then 9 echo "usage: $0 <object>" 10 echo "show ipfs pin information for object" 11 exit 1 12 fi 13 14 path=$1 15 16 echo "$path" | grep "/" >/dev/null 17 if [ "$?" -eq 0 ]; then 18 die "error: paths not supported. please resolve to hash first." 19 fi 20 21 ipfs pin ls --type=recursive | grep "$path" >/dev/null 22 [ "$?" -eq 0 ] && echo "$path pinned recursively" 23 24 ipfs pin ls --type=indirect | grep "$path" >/dev/null 25 [ "$?" -eq 0 ] && echo "$path pinned indirectly" 26 27 ipfs pin ls --type=direct | grep "$path" >/dev/null 28 [ "$?" -eq 0 ] && echo "$path pinned directly" 29 30 exit 0