# Licensed under the GNU GPLv3 free software license.
# No color if NOCOLOR is exported as true.
if [ "$NOCOLOR" != "true" ]; then
COL2="$(printf '\033[0;35m')" # Color 2
COL1="$(printf '\033[0m')" # Color 1
fi
ARG1=$1
ARG2=$2
ARGINF=$@
if [ "$ARG2" = "" ]; then
VIEWER=less
else
VIEWER="$ARG2"
echo "Using $ARG2 as output." | sed "s|-o|stdout|g"
fi
case "$VIEWER" in
"-o") VIEWER="cat" ;;
esac
echo "${0}. Run '$0 -h' to see a list of arguments or to jump to a specific section.\n$(cat /usr/share/speedwm-about /usr/share/speedwm-about-2 /usr/share/speedwm-bindlist /usr/share/speedwm-deplist /usr/share/speedwm-about-3 /usr/share/speedwm-xresources /usr/share/speedwm-about-4 /usr/share/speedwm-fsignal /usr/share/speedwm-about-5 | sed 's|xsetroot -name "fsignal:||g' | sed 's|"||g')" > /tmp/speedwm-doc
printf "\nYou need to $0 -whtml first." ; exit 1 ;;
"") $0 -h && exit 0 ;;
"-h") printf "speedwm help\n\nNo arguments to view this list of arguments.\n-h | View this list of arguments.\n-a | View everything.\n-1 | What is speedwm?\n-2 | List of all keybinds\n-3 | List of all dependencies\n-4 | .Xresources/Pywal information.\n-5 | Fsignal information\n-6 | Switching run launcher\n-7 | Installation\n-8 | Layouts\n-9| Important information.\n-w | Write documentation to ../readme\n-wmd | Write documentation (Markdown)\n-whtml | Write documentation (HTML) using markdown-to-html.\n-whtml-wtemplate | Combine template 1, output of -whtml and template 2 (from docs/) to create a full HTML document.\n\nIf second argument is -o, the requested output will be sent to stdout.\n-o can be replaced with a text editor or reader of your choice (such as less, vim, emacs, etc.)\n"; exit 0 ;;
"-1") sed "s|--|${COL2}--${COL1}|g" /usr/share/speedwm-about | head -n 10 > /tmp/stdout ; $VIEWER /tmp/stdout ;;