blob: 57e3fa89420d13564f30896bc8a91222562a6599 (
plain)
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
|
#!/bin/sh
help() {
echo "searchdb - update local search database
USAGE:
searchdb [OPTION]...
OPTIONS:
-x clear all databases
-h show this help message"
}
err() { printf 'searchdb: %s\n' "$@" >&2; exit 1; }
while getopts 'xh' o; do case "$o" in
x) rm -rf ~/.cache/search; exit ;;
h) help >&2; exit ;;
*) err "invalid option -- '$OPTARG'" ;;
esac done
shift $((OPTIND - 1))
rm -rf ~/.cache/search
export SEARCHDB="$HOME/.cache/search"
mkdir -p "$SEARCHDB" || exit
ln -sf /usr/share/dict/words "$SEARCHDB/word"
tldr --list > "$SEARCHDB/tldr"
apropos . > "$SEARCHDB/man"
pacman -Ss | sed -e "N;s/\n\s*/ => /" > "$SEARCHDB/pacman"
list() { find -L "$@" ! -wholename '*/.git*' -printf "%P\n"; }
list /usr/share/doc > "$SEARCHDB/wiki"
list ~/.local/share/Zeal/Zeal/docsets > "$SEARCHDB/docs"
list -L "/run/media/$USER/Storage/Media" > "$SEARCHDB/media"
list "/run/media/$USER/Storage/Library" > "$SEARCHDB/library"
|