dmenu-scripts/dmenu-wiki

25 lines
491 B
Plaintext
Raw Normal View History

2022-06-10 11:30:38 +02:00
#!/bin/sh
# Search offline copy of the arch wiki
2022-10-30 16:07:16 +01:00
. $HOME/.config/dmenu/config
2022-07-17 11:03:13 +02:00
2022-06-10 11:30:38 +02:00
dir="/usr/share/doc/arch-wiki/html/en/"
docs="$(find $dir -iname "*.html")"
main () {
choice=$(printf '%s\n' "${docs}" | \
cut -d '/' -f8- | \
sed -e 's/_/ /g' -e 's/.html//g' | \
sort | \
2022-07-17 11:03:13 +02:00
$DMENU -i -l 20 -p "Arch Wiki Docs:")
2022-06-10 11:30:38 +02:00
if [ "$choice" ]; then
article=$(printf '%s\n' "${dir}${choice}.html" | sed 's/ /_/g')
"$BROWSER" "$article"
fi
}
main