From b6d3c26ab4d56b8e3c94e99e43c66b1891fb6477 Mon Sep 17 00:00:00 2001 From: kaotisk Date: Thu, 3 Aug 2023 19:47:06 +0300 Subject: Tiny rework and cleanup --- bin/ak-unfollow | 39 +++++++++++++++++++++------------------ 1 file changed, 21 insertions(+), 18 deletions(-) (limited to 'bin/ak-unfollow') diff --git a/bin/ak-unfollow b/bin/ak-unfollow index 5810b6b..21f0da1 100755 --- a/bin/ak-unfollow +++ b/bin/ak-unfollow @@ -1,25 +1,28 @@ #!/bin/bash +PROGRAM="$(basename $0)" FOLLOWING="$HOME/.arching-kaos/following" fentries="$(cat $FOLLOWING)" if [ ! -z $1 ] then - search="$1" - sed -i -e 's,'"$search"',,g' $FOLLOWING - if [ $? == 0 ] - then - IPFS="$(ak-ipfs-add $FOLLOWING)" - if [ $? == 0 ] - then - profile set repositories "$IPFS" - else - ak-logthis "IPFS problem" - fi - else - ak-logthis "sed didn't found $search" - fi + search="$1" + sed -i -e 's,'"$search"',,g' $FOLLOWING + if [ $? != 0 ] + then + ak-logthis "<$PROGRAM>" "[ERROR]" "sed didn't found $search" + exit 1 + fi + IPFS="$(ak-ipfs-add $FOLLOWING)" + if [ $? != 0 ] + then + ak-logthis "<$PROGRAM>" "[ERROR]" "IPFS problem" + exit 1 + fi + ak-profile set repositories "$IPFS" + exit 0 else - echo "Who to unfollow?" - echo "Type following to see them" -fi - + echo "Who to unfollow?" + echo "Type following to see them" + exit 1 +fi + -- cgit v1.2.3