Blame Functions/Locale/locale_getArguments.sh

4c79b5
#!/bin/bash
4c79b5
#
057dc5
# locale_getArguments.sh -- This function interprets arguments passed to
6c8ab9
# `locale' functionality and calls actions accordingly.
4c79b5
#
9f5f2e
# Copyright (C) 2009-2011 Alain Reguera Delgado
4c79b5
# 
7cd8e9
# This program is free software; you can redistribute it and/or
7cd8e9
# modify it under the terms of the GNU General Public License as
7cd8e9
# published by the Free Software Foundation; either version 2 of the
7cd8e9
# License, or (at your option) any later version.
4c79b5
# 
4c79b5
# This program is distributed in the hope that it will be useful, but
4c79b5
# WITHOUT ANY WARRANTY; without even the implied warranty of
4c79b5
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
4c79b5
# General Public License for more details.
4c79b5
#
4c79b5
# You should have received a copy of the GNU General Public License
4c79b5
# along with this program; if not, write to the Free Software
4c79b5
# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
4c79b5
# USA.
4c79b5
# 
4c79b5
# ----------------------------------------------------------------------
418249
# $Id$
4c79b5
# ----------------------------------------------------------------------
4c79b5
057dc5
function locale_getArguments {
4c79b5
6c8ab9
    # Define short options we want to support.
786ebb
    local ARGSS=""
4c79b5
6c8ab9
    # Define long options we want to support.
8210e9
    local ARGSL="filter:,quiet,answer:,dont-commit-changes,update,edit,dont-create-mo"
4c79b5
6c8ab9
    # Parse arguments using getopt(1) command parser.
6c8ab9
    cli_doParseArguments
4c79b5
6c8ab9
    # Reset positional parameters using output from (getopt) argument
6c8ab9
    # parser.
6c8ab9
    eval set -- "$ARGUMENTS"
4c79b5
bf6bff
    # Look for options passed through command-line.
6c8ab9
    while true; do
6c8ab9
        case "$1" in
6c8ab9
d74c16
            --filter )
d74c16
                FLAG_FILTER="$2"
d74c16
                shift 2
d74c16
                ;;
d74c16
d74c16
            --quiet )
d74c16
                FLAG_QUIET="true"
d74c16
                FLAG_DONT_COMMIT_CHANGES="true"
d74c16
                shift 1
d74c16
                ;;
d74c16
d74c16
            --answer )
d74c16
                FLAG_ANSWER="$2"
d74c16
                shift 2
d74c16
                ;;
d74c16
d74c16
            --dont-commit-changes )
d74c16
                FLAG_DONT_COMMIT_CHANGES="true"
d74c16
                shift 1
d74c16
                ;;
d74c16
786ebb
            --update )
4e4b4d
                ACTIONNAM="${FUNCNAM}_updateMessages"
d74c16
                shift 1
6c8ab9
                ;;
6c8ab9
6c8ab9
            --edit )
4e4b4d
                ACTIONNAM="${FUNCNAM}_editMessages"
d74c16
                shift 1
6c8ab9
                ;;
6c8ab9
0d4faa
            --dont-create-mo )
0d4faa
                FLAG_DONT_CREATE_MO="true"
6a8fb5
                shift 1
6a8fb5
                ;;
6a8fb5
6c8ab9
            * )
6c8ab9
                break
4e4b4d
                ;;
6c8ab9
        esac
6c8ab9
    done
6c8ab9
d74c16
    # Redefine ARGUMENTS variable using current positional parameters. 
d74c16
    cli_doParseArgumentsReDef "$@"
bf6bff
4c79b5
}