Update script template
This commit is contained in:
parent
21b953f274
commit
feab6634b2
|
|
@ -68,19 +68,19 @@ die() {
|
||||||
|
|
||||||
needs_arg() {
|
needs_arg() {
|
||||||
if [ -z "${OPTARG}" ]; then
|
if [ -z "${OPTARG}" ]; then
|
||||||
>&2 echo "${0}: option requires an argument -- ${OPT}"
|
to_stderr "${0}: option requires an argument -- ${OPT}"
|
||||||
usage
|
usage
|
||||||
die
|
die
|
||||||
fi
|
fi
|
||||||
}
|
}
|
||||||
|
|
||||||
usage() {
|
usage() {
|
||||||
echo
|
to_stdout
|
||||||
echo "Template script."
|
to_stdout "Template script."
|
||||||
echo
|
to_stdout
|
||||||
to_stdout "${bld}Usage:${nc}"
|
to_stdout "${bld}Usage:${nc}"
|
||||||
to_stdout " ${dim}\$${nc} ${script_name}"
|
to_stdout " ${dim}\$${nc} ${script_name}"
|
||||||
echo
|
to_stdout
|
||||||
to_stdout "${bld}Options:${nc}"
|
to_stdout "${bld}Options:${nc}"
|
||||||
cat <<EOF | column -tds '|'
|
cat <<EOF | column -tds '|'
|
||||||
-e, --error|Exit with error
|
-e, --error|Exit with error
|
||||||
|
|
@ -129,12 +129,12 @@ main() {
|
||||||
done
|
done
|
||||||
|
|
||||||
debug "Start of main"
|
debug "Start of main"
|
||||||
echo "This is a template."
|
info "This is a template."
|
||||||
|
|
||||||
if [ -n "${OPTION}" ]; then
|
if [ -n "${OPTION}" ]; then
|
||||||
debug "Option is not empty"
|
debug "Option is not empty"
|
||||||
echo "Option is set to: ${OPTION}"
|
debug "Option is set to: ${OPTION}"
|
||||||
fi
|
fi
|
||||||
}
|
}
|
||||||
|
|
||||||
main "$@"
|
main "${@}"
|
||||||
Loading…
Reference in New Issue