Skip to content

Instantly share code, notes, and snippets.

@sulrich
Created February 23, 2022 21:17
Show Gist options
  • Save sulrich/f6b84c5ccac97d4687f2ba8b2ee5a68f to your computer and use it in GitHub Desktop.
Save sulrich/f6b84c5ccac97d4687f2ba8b2ee5a68f to your computer and use it in GitHub Desktop.
#!/bin/bash
help() {
cat << EOF
available functions:
EOF
sed -n "s/^##//p" "$0" | column -t -s ":" | sed -e "s/^/ /"
}
if [[ $# -lt 1 ]]; then
help
exit
fi
case $1 in
*)
# shift positional arguments so that arg 2 becomes arg 1, etc.
CMD=$1
shift 1
${CMD} ${@} || help
;;
esac
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment