code-style: slight cleanup
This commit is contained in:
6
sxbm
6
sxbm
@ -5,6 +5,7 @@
|
|||||||
# Author: NRK
|
# Author: NRK
|
||||||
## Copyright 2021 NRK
|
## Copyright 2021 NRK
|
||||||
## Licensed under GPL v3. See LICENSE for more details.
|
## Licensed under GPL v3. See LICENSE for more details.
|
||||||
|
# set -x
|
||||||
|
|
||||||
##########
|
##########
|
||||||
# CONFIG #
|
# CONFIG #
|
||||||
@ -81,6 +82,7 @@ bm_add() {
|
|||||||
die "Couldn't add link"
|
die "Couldn't add link"
|
||||||
}
|
}
|
||||||
|
|
||||||
|
# this entire function is a massive joke
|
||||||
bm_list() {
|
bm_list() {
|
||||||
QUERY_TAG=""
|
QUERY_TAG=""
|
||||||
QUERY_TITLE=""
|
QUERY_TITLE=""
|
||||||
@ -169,13 +171,13 @@ bm_remove() {
|
|||||||
[ -z "$1" ] && die "No arguments given"
|
[ -z "$1" ] && die "No arguments given"
|
||||||
|
|
||||||
[ "$1" -eq "$1" 2>/dev/null ] &&
|
[ "$1" -eq "$1" 2>/dev/null ] &&
|
||||||
LINK=$(sed "$1q;d" "$DATA_FILE") ||
|
LINK=$(sed "${1}q;d" "$DATA_FILE") ||
|
||||||
die "Link not found"
|
die "Link not found"
|
||||||
|
|
||||||
printf "Delete this link? (y/n)\n$LINK\n"
|
printf "Delete this link? (y/n)\n$LINK\n"
|
||||||
read ANSWER
|
read ANSWER
|
||||||
if [ "$ANSWER" = "y" ] || [ "$ANSWER" = "yes" ]; then
|
if [ "$ANSWER" = "y" ] || [ "$ANSWER" = "yes" ]; then
|
||||||
sed -i --follow-symlinks "$1d" "$DATA_FILE" &&
|
sed -i --follow-symlinks "${1}d" "$DATA_FILE" &&
|
||||||
echo "Deleted successfully" ||
|
echo "Deleted successfully" ||
|
||||||
die "Couldn't delete link"
|
die "Couldn't delete link"
|
||||||
fi
|
fi
|
||||||
|
|||||||
Reference in New Issue
Block a user