aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorkaotisk <kaotisk@arching-kaos.org>2023-08-03 19:47:06 +0300
committerkaotisk <kaotisk@arching-kaos.org>2023-08-03 19:47:06 +0300
commitb6d3c26ab4d56b8e3c94e99e43c66b1891fb6477 (patch)
treed169aa7463533b35f5bfac7c38ca6db34500428f
parent79abed7416cc95f83080a61c497d78891f4a7cbc (diff)
downloadarching-kaos-tools-b6d3c26ab4d56b8e3c94e99e43c66b1891fb6477.tar.gz
arching-kaos-tools-b6d3c26ab4d56b8e3c94e99e43c66b1891fb6477.tar.bz2
arching-kaos-tools-b6d3c26ab4d56b8e3c94e99e43c66b1891fb6477.zip
Tiny rework and cleanup
-rwxr-xr-xbin/ak-unfollow39
1 files changed, 21 insertions, 18 deletions
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
+