diff --git a/tools/func-bolerplate.bash b/tools/func-bolerplate.bash new file mode 100755 index 0000000..d2c4464 --- /dev/null +++ b/tools/func-bolerplate.bash @@ -0,0 +1,71 @@ +#!/usr/bin/env bash + +if [ $# -lt 2 ]; then + echo >&2 "Usage: $(basename "${0}") ..." + exit 1 +fi + +MODULE_NAME=${1,,} +GO_FILE="func-${MODULE_NAME//[-.]/_}.go" + +shift +FUNC_LIST= +i=0 +for name; do + if [ ${i} -gt 0 ]; then + if [ $((i+1)) -eq $# ]; then + FUNC_LIST+=" and " + else + FUNC_LIST+=", " + fi + fi + FUNC_LIST+="${name}()" + ((i++)) +done + +cat > "${GO_FILE}" <