Created
February 23, 2022 21:17
-
-
Save sulrich/f6b84c5ccac97d4687f2ba8b2ee5a68f to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/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