|
|
878a2b |
#!/bin/bash
|
|
|
878a2b |
#
|
|
|
e89945 |
# cli_printUrl.sh -- This function standardizes the way URLs are
|
|
|
e89945 |
# printed by centos-art.sh script. This function describes the
|
|
|
878a2b |
# domain organization of The CentOS Project through its URLs and
|
|
|
878a2b |
# provides a way to print them out when needed.
|
|
|
878a2b |
#
|
|
|
03486a |
# Copyright (C) 2009, 2010, 2011, 2012 The CentOS Project
|
|
|
878a2b |
#
|
|
|
878a2b |
# This program is free software; you can redistribute it and/or modify
|
|
|
878a2b |
# it under the terms of the GNU General Public License as published by
|
|
|
878a2b |
# the Free Software Foundation; either version 2 of the License, or (at
|
|
|
878a2b |
# your option) any later version.
|
|
|
878a2b |
#
|
|
|
878a2b |
# This program is distributed in the hope that it will be useful, but
|
|
|
878a2b |
# WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
|
878a2b |
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
|
|
878a2b |
# General Public License for more details.
|
|
|
878a2b |
#
|
|
|
878a2b |
# You should have received a copy of the GNU General Public License
|
|
|
878a2b |
# along with this program; if not, write to the Free Software
|
|
|
878a2b |
# Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
|
|
|
878a2b |
#
|
|
|
878a2b |
# ----------------------------------------------------------------------
|
|
|
878a2b |
# $Id$
|
|
|
878a2b |
# ----------------------------------------------------------------------
|
|
|
878a2b |
|
|
|
878a2b |
function cli_printUrl {
|
|
|
878a2b |
|
|
|
878a2b |
local URL=''
|
|
|
878a2b |
|
|
|
878a2b |
# Define short options.
|
|
|
878a2b |
local ARGSS=''
|
|
|
878a2b |
|
|
|
878a2b |
# Define long options.
|
|
|
c32b48 |
local ARGSL='domain,home,lists,wiki,forums,bugs,planet,docs,mirrors,projects,svn,trac,irc,cc-sharealike,with-locale,as-html-link'
|
|
|
878a2b |
|
|
|
c03943 |
# Initialize arguments with an empty value and set it as local
|
|
|
c03943 |
# variable to this function scope. Doing this is very important to
|
|
|
c03943 |
# avoid any clash with higher execution environments.
|
|
|
878a2b |
local ARGUMENTS=''
|
|
|
878a2b |
|
|
|
c03943 |
# Prepare ARGUMENTS for getopt.
|
|
|
878a2b |
cli_parseArgumentsReDef "$@"
|
|
|
878a2b |
|
|
|
c03943 |
# Redefine ARGUMENTS using getopt(1) command parser.
|
|
|
878a2b |
cli_parseArguments
|
|
|
878a2b |
|
|
|
878a2b |
# Redefine positional parameters using ARGUMENTS variable.
|
|
|
878a2b |
eval set -- "$ARGUMENTS"
|
|
|
878a2b |
|
|
|
878a2b |
# Look for options passed through command-line.
|
|
|
878a2b |
while true; do
|
|
|
878a2b |
case "$1" in
|
|
|
878a2b |
|
|
|
cf6e2e |
--domain )
|
|
|
cf6e2e |
URL="${TCAR_BRAND}.org"
|
|
|
cf6e2e |
shift 1
|
|
|
cf6e2e |
;;
|
|
|
cf6e2e |
|
|
|
878a2b |
--home )
|
|
|
cf6e2e |
URL="http://www.$(cli_printUrl --domain)/"
|
|
|
878a2b |
shift 1
|
|
|
878a2b |
;;
|
|
|
878a2b |
|
|
|
878a2b |
--lists )
|
|
|
cf6e2e |
URL="http://lists.$(cli_printUrl --domain)/"
|
|
|
878a2b |
shift 1
|
|
|
878a2b |
;;
|
|
|
878a2b |
|
|
|
878a2b |
--wiki )
|
|
|
cf6e2e |
URL="http://wiki.$(cli_printUrl --domain)/"
|
|
|
878a2b |
shift 1
|
|
|
878a2b |
;;
|
|
|
878a2b |
|
|
|
878a2b |
--forums )
|
|
|
cf6e2e |
URL="http://forums.$(cli_printUrl --domain)/"
|
|
|
878a2b |
shift 1
|
|
|
878a2b |
;;
|
|
|
878a2b |
|
|
|
878a2b |
--bugs )
|
|
|
cf6e2e |
URL="http://bugs.$(cli_printUrl --domain)/"
|
|
|
878a2b |
shift 1
|
|
|
878a2b |
;;
|
|
|
878a2b |
|
|
|
878a2b |
--projects )
|
|
|
c32b48 |
URL="https://projects.$(cli_printUrl --domain)/"
|
|
|
878a2b |
shift 1
|
|
|
878a2b |
;;
|
|
|
878a2b |
|
|
|
c32b48 |
--svn )
|
|
|
c32b48 |
URL="$(cli_printUrl --projects)svn/"
|
|
|
c32b48 |
shift 1
|
|
|
c32b48 |
;;
|
|
|
c32b48 |
|
|
|
c32b48 |
--trac )
|
|
|
c32b48 |
URL="$(cli_printUrl --projects)trac/"
|
|
|
878a2b |
shift 1
|
|
|
878a2b |
;;
|
|
|
878a2b |
|
|
|
878a2b |
--planet )
|
|
|
cf6e2e |
URL="http://planet.$(cli_printUrl --domain)/"
|
|
|
878a2b |
shift 1
|
|
|
878a2b |
;;
|
|
|
878a2b |
|
|
|
878a2b |
--docs )
|
|
|
cf6e2e |
URL="http://docs.$(cli_printUrl --domain)/"
|
|
|
878a2b |
shift 1
|
|
|
878a2b |
;;
|
|
|
878a2b |
|
|
|
878a2b |
--mirrors )
|
|
|
cf6e2e |
URL="http://mirrors.$(cli_printUrl --domain)/"
|
|
|
878a2b |
shift 1
|
|
|
878a2b |
;;
|
|
|
878a2b |
|
|
|
878a2b |
--irc )
|
|
|
cf6e2e |
URL="http://$(cli_printUrl --home)modules/tinycontent/index.php?id=8"
|
|
|
878a2b |
shift 1
|
|
|
878a2b |
;;
|
|
|
878a2b |
|
|
|
878a2b |
--cc-sharealike )
|
|
|
878a2b |
URL="http://creativecommons.org/licenses/by-sa/3.0/"
|
|
|
878a2b |
shift 1
|
|
|
878a2b |
;;
|
|
|
878a2b |
|
|
|
878a2b |
--with-locale )
|
|
|
9f72d8 |
if [[ ! ${LANG} =~ '^en' ]];then
|
|
|
c03943 |
URL="${URL}${CLI_LANG_LL}/"
|
|
|
878a2b |
fi
|
|
|
878a2b |
shift 1
|
|
|
878a2b |
;;
|
|
|
878a2b |
|
|
|
878a2b |
--as-html-link )
|
|
|
878a2b |
URL="${URL}"
|
|
|
878a2b |
shift 1
|
|
|
878a2b |
;;
|
|
|
878a2b |
|
|
|
878a2b |
-- )
|
|
|
878a2b |
|
|
|
878a2b |
shift 1
|
|
|
878a2b |
break
|
|
|
878a2b |
;;
|
|
|
878a2b |
esac
|
|
|
878a2b |
done
|
|
|
878a2b |
|
|
|
878a2b |
# Print Url.
|
|
|
878a2b |
echo "$URL"
|
|
|
878a2b |
|
|
|
878a2b |
}
|