added arch wiki offline search

This commit is contained in:
Niklas 2020-06-24 12:14:31 +02:00
parent e39a881b41
commit 3cb626d4a5

View File

@ -0,0 +1,24 @@
#!/usr/bin/env sh
# required packages:
# - fzf
# - arch-wiki-docs
set -e
DOC_DIR="/usr/share/doc/arch-wiki/html/en/"
cd "$DOC_DIR"
selected=$(find -type f | cut -c3- | rev | cut -c6- | rev | tr _ ' ' | fzf -q "$1")
selected_file=$(echo "$selected" | tr ' ' _ | awk -v var="$DOC_DIR" '{print var $0 ".html"}')
xdg-open "$selected_file"
#if [[ $# -eq 0 ]]; then
# # No arguments supplied
# xdg-open "$DOC_DIR"
#else
# grep -rwc '/usr/share/doc/arch-wiki/html/en/' -e 'xorg' | grep -v ":0" | awk -F":" '{print $2,$1}' | sort
#fi