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