commit 494e5dc11fd9558e7497a7b936f224eb02418fe9
parent ed11b7e2277030d8f3815aa3d85b31582f11f1a3
Author: Sven Möller <sven-moeller@outlook.de>
Date: Mon, 13 Dec 2021 15:40:34 +0100
Indent with tab, align with spaces
Diffstat:
1 file changed, 22 insertions(+), 22 deletions(-)
diff --git a/bin/.local/bin/bm b/bin/.local/bin/bm
@@ -1,8 +1,8 @@
#!/bin/sh
[ -z "$BM_DIR" ] \
- && echo "No directory specified!" \
- && exit 1
+ && echo "No directory specified!" \
+ && exit 1
urls_file="$BM_DIR/urls.txt"
archive_file="$BM_DIR/archive.txt"
@@ -13,13 +13,13 @@ export GIT_DIR="$BM_DIR/.git"
add () {
url="$1"
cat "$urls_file" "$archive_file" | grep "$url" \
- && notify-send "Already saved!" \
- && exit
+ && notify-send "Already saved!" \
+ && exit
[ -z "$2" ] \
- && title="$(curl --compressed --location $url \
- | grep -Eo '<title>.*</title>' \
- | sed -E 's-</?title>--g')" \
- || title="$2"
+ && title="$(curl --compressed --location $url \
+ | grep -Eo '<title>.*</title>' \
+ | sed -E 's-</?title>--g')" \
+ || title="$2"
echo "$url $title" >> "$urls_file"
@@ -28,19 +28,19 @@ add () {
list () {
[ -z "$1" ] \
- && file="$urls_file" \
- || file="$1"
+ && file="$urls_file" \
+ || file="$1"
cat -n "$file"
}
archive () {
url="$1"
[ -z "$2" ] \
- && from_file="$urls_file" \
- || from_file="$2"
+ && from_file="$urls_file" \
+ || from_file="$2"
[ -z "$3" ] \
- && to_file="$archive_file" \
- || to_file="$3"
+ && to_file="$archive_file" \
+ || to_file="$3"
sed -n "${url}p" "$from_file" >> "$to_file"
delete "$url" "$from_file"
@@ -49,16 +49,16 @@ archive () {
delete () {
url="$1"
[ -z "$2" ] \
- && file="$urls_file" \
- || file="$2"
+ && file="$urls_file" \
+ || file="$2"
sed -i "${url}d" "$file"
}
open () {
[ -z "$2" ] \
- && file="$urls_file" \
- || file="$2"
+ && file="$urls_file" \
+ || file="$2"
url="$(sed -n "$1p" "$file" | awk '{print $1}')"
xdg-open "$url"
@@ -66,11 +66,11 @@ open () {
interactive () {
[ -z "$1" ] \
- && from_file="$urls_file" \
- || from_file="$1"
+ && from_file="$urls_file" \
+ || from_file="$1"
[ -z "$2" ] \
- && to_file="$archive_file" \
- || to_file="$2"
+ && to_file="$archive_file" \
+ || to_file="$2"
line="$(list "$from_file" | fzf | awk '{print $1}')"
[ -z "$line" ] && exit