#!/bin/bash # speedwm-mkpage cd scripts export DOCDIR="../docs" # Set documentation directory so that it will ALWAYS use the latest documentation export USEPREFIX="false" # Set empty prefix MKPAGE() { ./speedwm-help -whtml ./speedwm-help -whtml-wtemplate cd .. rm -f readme.html echo "Created speedwm.html" } PUSHPAGE() { HTMLDIR=$(cat /tmp/speedwm-htmldir) cd $HTMLDIR || exit 1 git commit -a -m "speedwm-mkpage: Uploaded new page." git push && exit 0 echo "Could not git push." exit 1 } MKHTML() { ./speedwm-help -whtml cd .. echo "Created readme.html" } MKMD() { ./speedwm-help -wmd cd .. echo "Created README.md" } MK() { ./speedwm-help -w cd .. echo "Created readme" } # Perform actions based on user input case "$1" in "") echo "speedwm-mkpage\nNo arguments | Show the help screen\n-h | Show the help screen\n-mkpage | Create full page with templates from docs/\n-mkhtml | Create HTML document based on speedwm documentation\n-mkmd | Create markdown file (usually for use with GitHub repositories)\n-mk | Copy the output of speedwm-help -a to 'readme'.\n-ulspeedwm | Auto-push speedwm changes\n" ; exit 0 ;; "-help") $0 && exit 0 ;; "-h") $0 && exit 0 ;; "-mkpage") MKPAGE && exit 0 ;; "-mkhtml") MKHTML && exit 0 ;; "-mkmd") MKMD && exit 0 ;; "-mk") MK && exit 0 ;; "-page-push") PUSHPAGE && exit 0 ;; "-ulspeedwm") cd .. && git add * && git commit -a -m "speedwm-mkpage: Auto-pushed speedwm changes!" && git push && exit 0 ;; esac