Skip to content

Instantly share code, notes, and snippets.

@Stebalien
Created June 14, 2018 17:52
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save Stebalien/ef2bc2b1261d27d91782b456c24ab575 to your computer and use it in GitHub Desktop.
Save Stebalien/ef2bc2b1261d27d91782b456c24ab575 to your computer and use it in GitHub Desktop.
pin () {
ipfs swarm connect /ip4/104.131.131.82/tcp/4001/ipfs/QmaCpDMGvV2BGHeYERUEnRQAwe3N8SzbUtfsmvsqQLuvuJ
REFS=($@)
if ! test -t 0
then
while read line
do
REFS+=("$line")
done
fi
local total=$(ipfs refs -r ${REFS[@]} | wc -l)
local count=0
ipfs --api /ip4/104.131.131.82/tcp/8080 refs -r ${REFS[@]} | while read ref
do
let count++
printf "[%0${#total}d/%d] %s\n" "$count" "$total" "$ref"
done
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment