get_list_config.sh: change commandline parameter.

This commit is contained in:
Christoph 2018-05-12 17:47:11 +02:00
parent c6bdd98253
commit b5995bdab9

View File

@ -21,30 +21,26 @@ usage() {
[[ $terminal ]] && echo -e "
\033[1mUsage:\033[m
$(basename $0) -l <fq-list-address>
$(basename $0) <fq-list-address>
\033[1mDescription\033[m
Prints out the paraameter settings for the given list.
Prints out the paraameter settings for the requested list. The
full qualified listaddress is needed as comandline parameter.
\033[1mOptions\033[m
No Options (except '-h' for help) are available.
-h
Prints out this help.
-l name@domain
Prints out the configuration for the list \033[1mname@domain\033[m.
The list name must be given as full qualified list address. This
parameter is mandatory.
\033[1mExample:\033[m
Get configuration for list 'star@il-schleuder.de':
\033[1m$(basename $0) -l star@il-schleuder.de\033[m
\033[1m$(basename $0) star@il-schleuder.de\033[m
"
@ -188,10 +184,8 @@ fi
# - Read commandline parameter
# ----------
while getopts hl: opt ; do
while getopts h: opt ; do
case $opt in
l) FQ_LIST_NANE="$OPTARG"
;;
h) usage
;;
\?) usage ;;
@ -205,9 +199,14 @@ if [[ "$(trim $*)" =~ "--help" ]] ; then
fi
shift $(expr $OPTIND - 1)
[[ $# -eq "0" ]] || usage "Wrong number of arguments!"
[[ $# -eq "1" ]] || usage "Wrong number of arguments!"
[[ -n "$FQ_LIST_NANE" ]] || usage "List address not given! Use comandline parameter '-l'."
FQ_LIST_NANE="$1"
regex_email="^[A-Za-z0-9._+-]+@([A-Za-z0-9-]+\.)+[A-Za-z]{2,}$"
if [[ ! "$FQ_LIST_NANE" =~ $regex_email ]] ; then
fatal "The give list '$FQ_LIST_NANE' address isn't a valid e-mail address"
fi
# ----------
@ -235,7 +234,7 @@ fi
# - List present?
# -
if ! $(schleuder-cli lists list | grep -q -E "^${FQ_LIST_NANE}$" 2>/dev/null) ; then
fatal "List '$FQ_LIST_NANE' not found at this server!"
fatal "List '$FQ_LIST_NANE' was not found at this server!"
fi
# ----------
@ -273,4 +272,33 @@ for _option in $list_options ; do
fi
done
if $terminal ; then
echo ""
echo ""
echo -e " \033[1mAdmin adresse(s) of list \033[32m\033[1m$FQ_LIST_NANE\033[32m ..\033[m"
echo ""
else
echo ""
echo " Admin adresses of list list '$FQ_LIST_NANE':"
fi
admin_subscriptions="$(schleuder-cli subscriptions list ckubu-test1@il-schleuder.de 2> $log_file | grep admin | awk '{print$1":"$2}')"
if [[ -s "$log_file" ]] ; then
error "$(cat "${log_file}")"
fi
for _val in $admin_subscriptions ; do
IFS=':' read -a _val_arr <<< "${_val}"
if $terminal ; then
if [[ ${#_val_arr[0]} -lt 46 ]] ; then
echo -e " ${_val_arr[0]}\033[50G${_val_arr[1]}"
else
echo -e " ${_val_arr[0]} ${_val_arr[1]}"
fi
else
echo " ${_val_arr[0]} ${_val_arr[1]}"
fi
done
clean_up 1