diff options
author | kaotisk <kaotisk@arching-kaos.org> | 2023-08-03 19:34:39 +0300 |
---|---|---|
committer | kaotisk <kaotisk@arching-kaos.org> | 2023-08-03 19:34:39 +0300 |
commit | 11a4191c4ccb308614cb8fcf883d29c757109f45 (patch) | |
tree | 552d621f6e20253ca14ce3160613e2d159f729df | |
parent | 09e8affcadf0106bef20f2ba0a6a19e9f2e3e1fe (diff) | |
download | arching-kaos-tools-11a4191c4ccb308614cb8fcf883d29c757109f45.tar.gz arching-kaos-tools-11a4191c4ccb308614cb8fcf883d29c757109f45.tar.bz2 arching-kaos-tools-11a4191c4ccb308614cb8fcf883d29c757109f45.zip |
Cleanup and fixed call to script
-rwxr-xr-x | bin/ak-follow | 27 |
1 files changed, 18 insertions, 9 deletions
diff --git a/bin/ak-follow b/bin/ak-follow index 9177c7f..0d6107c 100755 --- a/bin/ak-follow +++ b/bin/ak-follow @@ -1,14 +1,23 @@ #!/bin/bash FOLLOWING="$HOME/.arching-kaos/following" +PROGRAM="$(basename $0)" if [ ! -z $1 ] then - echo $1 >> $FOLLOWING - IPFS=$(ak-ipfs-add $FOLLOWING) - if [ $? == 0 ] - then - profile set following $IPFS - else - ak-logthis "Addition aborted" - exit 1 - fi + grep $1 $FOLLOWING + if [ $? == 0 ] + then + ak-logthis "<$(basename $0)>" "[ERROR]" "Already exists" + exit 1 + fi + echo $1 >> $FOLLOWING + IPFS=$(ak-ipfs-add $FOLLOWING) + if [ $? != 0 ] + then + ak-logthis "<$PROGRAM>" "[ERROR]" "Addition failed" + exit 1 + fi + ak-profile set following $IPFS + exit 0 fi +printf "Usage:\n\t%s <AKID_IPFS_CID_v0>\n" $PROGRAM +exit 1 |