commit d7fdc4ecb4782467c1344459d0d84e25f83840c6
parent 175c6a1f16610bfec3275c5dad29666475d531a1
Author: René Wagner <rwa@clttr.info>
Date: Tue, 14 Dec 2021 20:29:31 +0100
move bookmarks file to config dir
instead of storing the bookmark in .cache/astro, which should
be ephemeral, we are moving the bookmarks file to .config/astro
Old file is moved to the new destination on first start.
Diffstat:
1 file changed, 10 insertions(+), 3 deletions(-)
diff --git a/astro b/astro
@@ -258,13 +258,13 @@ fetch() {
echo "Enter description: (optional)"
read -r desc <&1
url="$1://$2:$3/$4"
- echo "$url $desc" >> "$cachedir/bookmarks"
+ echo "$url $desc" >> "$bookmarkfile"
;;
55)
- cat -n "$cachedir/bookmarks"
+ cat -n "$bookmarkfile"
printf "Enter link number: "
read -r i <&1
- url="$(sed "${i}q;d" "$cachedir/bookmarks" | cut -d' ' -f1)"
+ url="$(sed "${i}q;d" "$bookmarkfile" | cut -d' ' -f1)"
esac
read -r proto host port path << EOF
@@ -297,12 +297,19 @@ tput smcup
confighome=${XDG_CONFIG_HOME:-$HOME/.config}
mkdir -p "$confighome/astro"
configfile="$confighome/astro/astro.conf"
+bookmarkfile="$confighome/astro/bookmarks"
cachehome=${XDG_CACHE_HOME:-$HOME/.cache}
mkdir -p "$cachehome/astro"
cachedir="$cachehome/astro"
histfile="$cachedir/history"
+# move old bookmark file to new location
+if [ -f "$cachedir/bookmarks" ] && [ ! -f "$bookmarkfile" ]
+then
+ mv "$cachedir/bookmarks" "$bookmarkfile"
+fi
+
LESSKEY="$confighome/astro/less.keys"
# Restore terminal