Blame Scripts/Bash/Functions/Commons/cli_printMailingList.sh

f4d44a
#!/bin/bash
f4d44a
#
e3827b
# cli_printMailingList.sh -- This function standardize the way mailing
e48498
# list addresses are printed on content produced by centos-art.sh
e48498
# script.
f4d44a
#
e6bbbf
# Copyright (C) 2009-2013 The CentOS Project
f4d44a
#
f4d44a
# This program is free software; you can redistribute it and/or modify
f4d44a
# it under the terms of the GNU General Public License as published by
f4d44a
# the Free Software Foundation; either version 2 of the License, or (at
f4d44a
# your option) any later version.
f4d44a
#
f4d44a
# This program is distributed in the hope that it will be useful, but
f4d44a
# WITHOUT ANY WARRANTY; without even the implied warranty of
f4d44a
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
f4d44a
# General Public License for more details.
f4d44a
#
f4d44a
# You should have received a copy of the GNU General Public License
f4d44a
# along with this program; if not, write to the Free Software
f4d44a
# Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
f4d44a
#
f4d44a
# ----------------------------------------------------------------------
f4d44a
# $Id$
f4d44a
# ----------------------------------------------------------------------
f4d44a
e3827b
function cli_printMailingList {
f4d44a
f4d44a
    local MAILADDRS=''
f4d44a
f4d44a
    # Define short options.
f4d44a
    local ARGSS=''
f4d44a
f4d44a
    # Define long options.
f4d44a
    local ARGSL='as-html-link:,docs'
f4d44a
f4d44a
    # Initialize arguments with an empty value and set it as local
f4d44a
    # variable to this function scope. Doing this is very important to
f4d44a
    # avoid any clash with higher execution environments.
f4d44a
    local ARGUMENTS=''
f4d44a
f4d44a
    # Prepare ARGUMENTS for getopt.
f4d44a
    cli_parseArgumentsReDef "$@"
f4d44a
f4d44a
    # Redefine ARGUMENTS using getopt(1) command parser.
f4d44a
    cli_parseArguments
f4d44a
f4d44a
    # Redefine positional parameters using ARGUMENTS variable.
f4d44a
    eval set -- "$ARGUMENTS"
f4d44a
f4d44a
    # Look for options passed through command-line.
f4d44a
    while true; do
f4d44a
        case "$1" in
f4d44a
f4d44a
            --docs )
f4d44a
                MAILADDRS="${TCAR_BRAND}-docs@$(cli_printUrl --domain)"
cde1ef
                shift 1
f4d44a
                ;;
f4d44a
f4d44a
            --as-html-link )
f4d44a
                MAILADDRS="${2}"
f4d44a
                shift 2
f4d44a
                ;;
f4d44a
f4d44a
            -- )
f4d44a
f4d44a
                shift 1
f4d44a
                break
f4d44a
                ;;
f4d44a
        esac
f4d44a
    done
f4d44a
f4d44a
    # Print mail address.
f4d44a
    echo "$MAILADDRS"
f4d44a
f4d44a
}