#!/bin/sh

LANGUAGE=en
BROWSER=surf

entries=$(find "/usr/share/doc/arch-wiki/html/$LANGUAGE" -type f | sed -n "s|/usr/share/doc/arch-wiki/html/$LANGUAGE/||p" | sed -n "s/\.html$//p")

selection=$(echo "$entries" | sort | dmenu -i -l 6 -p "Select Arch Wiki Page: ")

if [ "$selection" = "" ]; then
  exit 0
fi

$BROWSER "/usr/share/doc/arch-wiki/html/$LANGUAGE/$selection.html"
