From a7c77e64c31b2d02b83b8a3a6fbea7da05934f47 Mon Sep 17 00:00:00 2001 From: cronyakatsuki Date: Fri, 10 Jun 2022 11:30:38 +0200 Subject: [PATCH] Script to search arch wiki. --- dmenu-wiki | 22 ++++++++++++++++++++++ 1 file changed, 22 insertions(+) create mode 100755 dmenu-wiki diff --git a/dmenu-wiki b/dmenu-wiki new file mode 100755 index 0000000..05912d8 --- /dev/null +++ b/dmenu-wiki @@ -0,0 +1,22 @@ +#!/bin/sh + +# Search offline copy of the arch wiki + +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 | \ + dmenu -i -l 20 -p "Arch Wiki Docs:") + + if [ "$choice" ]; then + article=$(printf '%s\n' "${dir}${choice}.html" | sed 's/ /_/g') + "$BROWSER" "$article" + fi +} + +main