#!/bin/sh
# Read ASD documentation

cd "$ASD_ROOT/usr/share/doc/asd" 2>/dev/null || {
    printf 'Documentation is missing from /usr/share/doc/asd\n'
    exit 1
}

[ -f "${1:-.}/index.txt" ] && file=./${1:-.}/index.txt
[ -f "${1:-.}.txt" ]       && file=./${1:-.}.txt
[ -f "${1:-:}" ]           && file=./${1:-.}

"${PAGER:-less}" "${file:-404.txt}"
