From 3cb626d4a5f07a2cdd45fd3643d5dc4164a16896 Mon Sep 17 00:00:00 2001 From: Niklas Date: Wed, 24 Jun 2020 12:14:31 +0200 Subject: [PATCH] added arch wiki offline search --- .local/share/scripts/arch-wiki.sh | 24 ++++++++++++++++++++++++ 1 file changed, 24 insertions(+) create mode 100755 .local/share/scripts/arch-wiki.sh diff --git a/.local/share/scripts/arch-wiki.sh b/.local/share/scripts/arch-wiki.sh new file mode 100755 index 0000000..12b042f --- /dev/null +++ b/.local/share/scripts/arch-wiki.sh @@ -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 + +