add -d (domain) option as alias to -z (zone)

This commit is contained in:
Matthew Saunders Brown 2023-08-08 13:21:39 -07:00
parent 0217028874
commit 8ba15ef4f0

View File

@ -122,7 +122,7 @@ function pdns::yesno() {
function pdns:getoptions () {
local OPTIND
while getopts "hbz:m:t:a:n:r:c:l:s:x" opt ; do
while getopts "hbz:d:m:t:a:n:r:c:l:s:x" opt ; do
case "${opt}" in
h ) # display help and exit
help
@ -142,6 +142,17 @@ function pdns:getoptions () {
exit
fi
;;
d ) # domain (alias of zone)
zone=${OPTARG,,}
# pdns stores zone name without trailing dot, remove if found
if [[ ${zone: -1} = '.' ]]; then
zone=${zone::-1}
fi
if ! vmail::validate_domain $zone; then
echo "ERROR: $zone is not a valid domain name."
exit
fi
;;
m ) # master - IP of master if this is a slave zone
master=${OPTARG}
;;