/
repomenue_bm
executable file
·50 lines (44 loc) · 1.11 KB
/
repomenue_bm
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
#!/usr/bin/env bash
# -*-coding:utf-8 -*-
# Auto updated?
# Yes
#File :
# repomenue_bm
#Author:
# The-Repo-Club [wayne6324@gmail.com]
#Github:
# https://github.com/The-Repo-Club/
#
# Created:
# Wed 10 March 2021, 12:34:47 PM [GMT]
# Modified:
# Fri 21 January 2022, 02:29:56 PM [GMT]
#
# Description:
# <Todo>
#
declare -A g bmarray;
while IFS=\| read -r guid date id url title tags;
do
bookmark="$title "-" "$url" "-" "$tags"";
bmarray["$bookmark"]="$url";
done < "$HOME/.config/repomenu/bookmarks/bm.lnk"
function load() {
printf "Add\nRemove\n"
while IFS=\| read -r guid date id url title tags;
do
bookmark="$title "-" "$url" "-" "$tags"";
printf "$bookmark\n";
done < "$HOME/.config/repomenu/bookmarks/bm.lnk"
}
choice=$(load | repomenu -ps 1 -l 20 -w -400 -i -h -1 -y -1 -bw 4 -q "${1:-Add/Open bookmark:...}" -H -x 10000)
LOOPSETTING="true"
while [ -n "$LOOPSETTING" ]; do
[ -n "$choice" ] || exit
unset LOOPSETTING
case "$choice" in
Add) repomenue_bm_add ;;
Remove) repomenue_bm_remove ;;
*) bm -w "$HOME/.config/repomenu/bookmarks/" -o ${bmarray[$choice]};;
esac
done