aboutsummaryrefslogtreecommitdiff
path: root/bin/ak-ipns-resolve
blob: e93218e508238794eff15b7e955ed09703b074fc (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
#!/bin/bash
PROGRAM="$(basename $0)"
usage(){
	echo "$PROGRAM - Resolves IPNS to IPFS"
	echo "------------------------------------"
	echo "Usage:"
	echo "	$PROGRAM <IPNS>"
	echo ""
	echo "Returns the resolved IPFS CIDv0"
}
logit(){
	ak-logthis "<$PROGRAM>" "$1" "$2"
}
if [ ! -z $1 ]
then
	rsld=$(ak-ipfs-name-resolve $1)
	if [ "$?" != 0 ]
	then
		logit "[ERROR]" "Failed to resolve $1"
		exit 1
	fi
       	echo -n $rsld | sed -e 's/\/ipfs\///'
	logit "[INFO]" "Resolved $1 to $rsld"
else
	usage
fi