dotfiles-remastered/.local/share/scripts/arch-wiki.sh

25 lines
535 B
Bash
Executable File

#!/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