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

878a2b
#!/bin/bash
878a2b
#
878a2b
# cli_getCountryCodes.sh -- This function outputs a list with country
878a2b
# codes as defined in ISO3166 standard.
878a2b
#
878a2b
# Copyright (C) 2009, 2010, 2011 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_getCountryCodes {
878a2b
878a2b
    local FILTER="$(echo $1 | cut -d_ -f2)"
878a2b
878a2b
    COUNTRYCODES='AD 
878a2b
        AE 
878a2b
        AF 
878a2b
        AG 
878a2b
        AI 
878a2b
        AL 
878a2b
        AM 
878a2b
        AN 
878a2b
        AO 
878a2b
        AQ 
878a2b
        AR 
878a2b
        AS 
878a2b
        AT 
878a2b
        AU 
878a2b
        AW 
878a2b
        AZ 
878a2b
        BA 
878a2b
        BB 
878a2b
        BD 
878a2b
        BE 
878a2b
        BF 
878a2b
        BG 
878a2b
        BH 
878a2b
        BI 
878a2b
        BJ 
878a2b
        BM 
878a2b
        BN 
878a2b
        BO 
878a2b
        BR 
878a2b
        BS 
878a2b
        BT 
878a2b
        BV 
878a2b
        BW 
878a2b
        BY 
878a2b
        BZ 
878a2b
        CA 
878a2b
        CC 
878a2b
        CD 
878a2b
        CF 
878a2b
        CG 
878a2b
        CH 
878a2b
        CI 
878a2b
        CK 
878a2b
        CL 
878a2b
        CM 
878a2b
        CN 
878a2b
        CO 
878a2b
        CR 
878a2b
        CS 
878a2b
        CU 
878a2b
        CV 
878a2b
        CX 
878a2b
        CY 
878a2b
        CZ 
878a2b
        DE 
878a2b
        DJ 
878a2b
        DK 
878a2b
        DM 
878a2b
        DO 
878a2b
        DZ 
878a2b
        EC 
878a2b
        EE 
878a2b
        EG 
878a2b
        EH 
878a2b
        ER 
878a2b
        ES 
878a2b
        ET 
878a2b
        FI 
878a2b
        FJ 
878a2b
        FK 
878a2b
        FM 
878a2b
        FO 
878a2b
        FR 
878a2b
        GA 
878a2b
        GB 
878a2b
        GD 
878a2b
        GE 
878a2b
        GF 
878a2b
        GH 
878a2b
        GI 
878a2b
        GL 
878a2b
        GM 
878a2b
        GN 
878a2b
        GP 
878a2b
        GQ 
878a2b
        GR 
878a2b
        GS 
878a2b
        GT 
878a2b
        GU 
878a2b
        GW 
878a2b
        GY 
878a2b
        HK 
878a2b
        HM 
878a2b
        HN 
878a2b
        HR 
878a2b
        HT 
878a2b
        HU 
878a2b
        ID 
878a2b
        IE 
878a2b
        IL 
878a2b
        IN 
878a2b
        IO 
878a2b
        IQ 
878a2b
        IR 
878a2b
        IS 
878a2b
        IT 
878a2b
        JM 
878a2b
        JO 
878a2b
        JP 
878a2b
        KE 
878a2b
        KG 
878a2b
        KH 
878a2b
        KI 
878a2b
        KM 
878a2b
        KN 
878a2b
        KP 
878a2b
        KR 
878a2b
        KW 
878a2b
        KY 
878a2b
        KZ 
878a2b
        LA 
878a2b
        LB 
878a2b
        LC 
878a2b
        LI 
878a2b
        LK 
878a2b
        LR 
878a2b
        LS 
878a2b
        LT 
878a2b
        LU 
878a2b
        LV 
878a2b
        LY 
878a2b
        MA 
878a2b
        MC 
878a2b
        MD 
878a2b
        MG 
878a2b
        MH 
878a2b
        MK 
878a2b
        ML 
878a2b
        MM 
878a2b
        MN 
878a2b
        MO 
878a2b
        MP 
878a2b
        MQ 
878a2b
        MR 
878a2b
        MS 
878a2b
        MT 
878a2b
        MU 
878a2b
        MV 
878a2b
        MW 
878a2b
        MX 
878a2b
        MY 
878a2b
        MZ 
878a2b
        NA 
878a2b
        NC 
878a2b
        NE 
878a2b
        NF 
878a2b
        NG 
878a2b
        NI 
878a2b
        NL 
878a2b
        NO 
878a2b
        NP 
878a2b
        NR 
878a2b
        NU 
878a2b
        NZ 
878a2b
        OM 
878a2b
        PA 
878a2b
        PE 
878a2b
        PF 
878a2b
        PG 
878a2b
        PH 
878a2b
        PK 
878a2b
        PL 
878a2b
        PM 
878a2b
        PN 
878a2b
        PR 
878a2b
        PS 
878a2b
        PT 
878a2b
        PW 
878a2b
        PY 
878a2b
        QA 
878a2b
        RE 
878a2b
        RO 
878a2b
        RU 
878a2b
        RW 
878a2b
        SA 
878a2b
        SB 
878a2b
        SC 
878a2b
        SD 
878a2b
        SE 
878a2b
        SG 
878a2b
        SH 
878a2b
        SI 
878a2b
        SJ 
878a2b
        SK 
878a2b
        SL 
878a2b
        SM 
878a2b
        SN 
878a2b
        SO 
878a2b
        SR 
878a2b
        ST 
878a2b
        SV 
878a2b
        SY 
878a2b
        SZ 
878a2b
        TC 
878a2b
        TD 
878a2b
        TF 
878a2b
        TG 
878a2b
        TH 
878a2b
        TJ 
878a2b
        TK 
878a2b
        TL 
878a2b
        TM 
878a2b
        TN 
878a2b
        TO 
878a2b
        TR 
878a2b
        TT 
878a2b
        TV 
878a2b
        TW 
878a2b
        TZ 
878a2b
        UA 
878a2b
        UG 
878a2b
        UM 
878a2b
        US 
878a2b
        UY 
878a2b
        UZ 
878a2b
        VA 
878a2b
        VC 
878a2b
        VE 
878a2b
        VG 
878a2b
        VI 
878a2b
        VN 
878a2b
        VU 
878a2b
        WF 
878a2b
        WS 
878a2b
        YE 
878a2b
        YT 
878a2b
        ZA 
878a2b
        ZM 
878a2b
        ZW'
878a2b
878a2b
    if [[ $FILTER != '' ]];then
878a2b
        echo $COUNTRYCODES | egrep "$FILTER"
878a2b
    else
878a2b
        echo "$COUNTRYCODES"
878a2b
    fi
878a2b
878a2b
}