Blame Scripts/Bash/Functions/Vcs/Subversion/subversion_getOptions.sh

384602
#!/bin/bash
384602
#
3b9515
# subversion_getOptions.sh -- This function interprets option
3b9515
# parameters passed to `svn' functionality and calls actions
3b9515
# accordingly.
384602
#
384602
# Copyright (C) 2009, 2010, 2011, 2012 The CentOS Project
384602
#
384602
# This program is free software; you can redistribute it and/or modify
384602
# it under the terms of the GNU General Public License as published by
384602
# the Free Software Foundation; either version 2 of the License, or (at
384602
# your option) any later version.
384602
#
384602
# This program is distributed in the hope that it will be useful, but
384602
# WITHOUT ANY WARRANTY; without even the implied warranty of
384602
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
384602
# General Public License for more details.
384602
#
384602
# You should have received a copy of the GNU General Public License
384602
# along with this program; if not, write to the Free Software
384602
# Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
384602
#
384602
# ----------------------------------------------------------------------
384602
# $Id$
384602
# ----------------------------------------------------------------------
384602
3b9515
function subversion_getOptions {
384602
384602
    # Define short options we want to support.
c3a29f
    local ARGSS="h,q"
384602
384602
    # Define long options we want to support.
3b9515
    local ARGSL="help,quiet,synchronize,update,commit,is-versioned,get-status,mkdir,copy,delete"
384602
f98b49
    # Redefine ARGUMENTS using getopt(1) command parser.
384602
    cli_parseArguments
384602
384602
    # Redefine positional parameters using ARGUMENTS variable.
384602
    eval set -- "$ARGUMENTS"
384602
384602
    # Look for options passed through command-line.
384602
    while true; do
384602
384602
        case "$1" in
384602
c3a29f
            -h | --help )
3b9515
                cli_runFnEnvironment help --read --format="texinfo" "tcar-fs::scripts:bash-functions-vcs-subversion"
c3a29f
                shift 1
c3a29f
                exit
c3a29f
                ;;
c3a29f
c3a29f
            -q | --quiet )
c3a29f
                FLAG_QUIET="true"
c3a29f
                shift 1
c3a29f
                ;;
c3a29f
3b9515
            --synchronize )
3b9515
                ACTIONNAMS="${ACTIONNAMS} subversion_syncRepoChanges"
384602
                shift 1
384602
                ;;
384602
384602
            --commit )
3b9515
                ACTIONNAMS="${ACTIONNAMS} subversion_commitRepoChanges"
384602
                shift 1
384602
                ;;
384602
384602
            --update )
3b9515
                ACTIONNAMS="${ACTIONNAMS} subversion_updateRepoChanges"
384602
                shift 1
384602
                ;;
384602
274988
            --is-versioned )
3b9515
                ACTIONNAMS="${ACTIONNAMS} subversion_isVersioned"
384602
                shift 1
384602
                ;;
384602
bc39d6
            --get-status )
3b9515
                ACTIONNAMS="${ACTIONNAMS} subversion_getRepoStatus"
bc39d6
                shift 1
bc39d6
                ;;
bc39d6
c3a29f
            --copy )
3b9515
                ACTIONNAMS="${ACTIONNAMS} subversion_copyRepoFile"
c3a29f
                shift 1
c3a29f
                ;;
c3a29f
a8ad63
            --mkdir )
3b9515
                ACTIONNAMS="${ACTIONNAMS} subversion_mkRepoDirectory"
a8ad63
                shift 1
a8ad63
                ;;
a8ad63
dd9760
            --delete )
3b9515
                ACTIONNAMS="${ACTIONNAMS} subversion_deleteRepoFile"
dd9760
                shift 1
dd9760
                ;;
dd9760
384602
            -- )
384602
                # Remove the `--' argument from the list of arguments
384602
                # in order for processing non-option arguments
384602
                # correctly. At this point all option arguments have
384602
                # been processed already but the `--' argument still
384602
                # remains to mark ending of option arguments and
3b9515
                # beginning of non-option arguments. The `--' argument
384602
                # needs to be removed here in order to avoid
384602
                # centos-art.sh script to process it as a path inside
384602
                # the repository, which obviously is not.
384602
                shift 1
384602
                break
384602
                ;;
384602
        esac
384602
    done
384602
384602
    # Redefine ARGUMENTS variable using current positional parameters. 
384602
    cli_parseArgumentsReDef "$@"
384602
384602
}