added possibility to document template parameters
This commit is contained in:
25
template.sh
25
template.sh
@@ -3,8 +3,9 @@
|
||||
while test $# -gt 0; do
|
||||
case "$1" in
|
||||
(-h|--help) if test -e "${!#}"; then
|
||||
sed -n 's,^ *# \( *[^-]\),\1,p' "${!#}"
|
||||
cat <<EOF
|
||||
$0 $(sed -n 's,^ *# *,,p' "${!#}" | tr '\n' ' ') ${!#}
|
||||
$0 $(sed -n 's,^ *# \+-,-,p' "${!#}" | tr '\n' ' ') ${!#}
|
||||
EOF
|
||||
else
|
||||
cat <<EOF
|
||||
@@ -26,8 +27,19 @@ FILE
|
||||
and execute bash commands, e.g. you are allowed wo use the \$()
|
||||
expression.
|
||||
|
||||
Document the parameters that shall be used in comment lines, this
|
||||
are lines thet start with # followed by -v or -p options.
|
||||
Document the template and the parameters that in comment
|
||||
lines. Comment lines that start with a hash and a space ("# "). If
|
||||
a dash ("-") follows, then this line documents a parameter.
|
||||
|
||||
Example:
|
||||
|
||||
# this is an arbitrary documentation line that is copied
|
||||
# these are the parameters:
|
||||
#
|
||||
# -v VAR1=
|
||||
# -v VAR2=
|
||||
# -p PWD1
|
||||
# -p PWD2
|
||||
|
||||
DESCRIPTION
|
||||
|
||||
@@ -39,9 +51,10 @@ EXAMPLE
|
||||
|
||||
file wordpress.tpl
|
||||
-----------------------------------------------------------------------------
|
||||
# -v NAME=
|
||||
# -v PORT=
|
||||
# -p PASSWORD
|
||||
# this templeate starts a wordpress given an name and a port
|
||||
# -v NAME=
|
||||
# -v PORT=
|
||||
# -p PASSWORD
|
||||
version: '3.3'
|
||||
services:
|
||||
mysql:
|
||||
|
Reference in New Issue
Block a user