mirror of
https://github.com/rwxrob/dot
synced 2024-11-18 15:25:52 +00:00
20 lines
407 B
Bash
Executable File
20 lines
407 B
Bash
Executable File
#!/usr/bin/env bash
|
|
|
|
_trim() {
|
|
local it="${1#"${1%%[![:space:]]*}"}"
|
|
echo -e "${it%"${it##*[![:space:]]}"}"
|
|
}
|
|
|
|
receiver="$1"
|
|
|
|
while IFS= read -r name; do
|
|
name=$(_trim "$name")
|
|
[[ -z "$name" ]] && continue
|
|
printf "func (r *%s) %s() string {return r.%s}\n" \
|
|
"$receiver" "${name^}" "${name,}"
|
|
printf "func (r *%s) Set%s(v string) {r.%s = v}\n" \
|
|
"$receiver" "${name^}" "${name,}"
|
|
done
|
|
|
|
|