Blame Scripts/Bash/Functions/Path/path_getActions.sh

407d66
#!/bin/bash
407d66
#
407d66
# path_getActions.sh -- This function defines the command-line
407d66
# interface used to manipulate repository files.
407d66
#
407d66
# Copyright (C) 2009, 2010 Alain Reguera Delgado
407d66
# 
407d66
# This program is free software; you can redistribute it and/or modify
407d66
# it under the terms of the GNU General Public License as published by
407d66
# the Free Software Foundation; either version 2 of the License, or
407d66
# (at your option) any later version.
407d66
# 
407d66
# This program is distributed in the hope that it will be useful, but
407d66
# WITHOUT ANY WARRANTY; without even the implied warranty of
407d66
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
407d66
# General Public License for more details.
407d66
#
407d66
# You should have received a copy of the GNU General Public License
407d66
# along with this program; if not, write to the Free Software
407d66
# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
407d66
# USA.
407d66
# 
407d66
# ----------------------------------------------------------------------
407d66
# $Id$
407d66
# ----------------------------------------------------------------------
407d66
    
407d66
function path_getActions {
407d66
407d66
    # Define source location we are going to work with.
407d66
    local SOURCE="$ACTIONVAL"
407d66
6ecc07
    # Define short options we want to support.
6ecc07
    local ARGSS="r:m:t:"
6ecc07
6ecc07
    # Define long options we want to support.
6ecc07
    local ARGSL="revision:,message:,to:"
6ecc07
6ecc07
    # Parse arguments using getopt(1) command parser.
6ecc07
    cli_doParseArguments
6ecc07
6ecc07
    # Reset positional parameters using output from (getopt) argument
6ecc07
    # parser.
6ecc07
    eval set -- "$ARGUMENTS"
6ecc07
6ecc07
    # Define target locations using positonal parameters as
6ecc07
    # reference.
6ecc07
    while true; do
6ecc07
        case "$1" in
6ecc07
            -t|--to )
6ecc07
                TARGET="$2"
6ecc07
                cli_checkRepoDirTarget
6ecc07
                shift 2
6ecc07
                ;;
6ecc07
            * )
6ecc07
                break 
6ecc07
        esac
6ecc07
    done
6ecc07
6ecc07
    # Redefine positional parameters stored inside ARGUMENTS variable.
6ecc07
    cli_doParseArgumentsReDef "$@"
6ecc07
6ecc07
    # Parse positional parameters stored inside ARGUMENTS variable.
6ecc07
    cli_doParseArguments
6ecc07
407d66
    # Evaluate action name and define which actions does centos-art.sh
407d66
    # script supports.
407d66
    while true; do
407d66
        case "$ACTIONNAM" in
407d66
407d66
            '--copy' )
407d66
                # Duplicate something in working copy or repository,
407d66
                # remembering history.
407d66
                path_doCopy
407d66
                ;;
407d66
407d66
            '--move' )
407d66
                # Move and/or rename something in working copy or
407d66
                # repository.
407d66
                # --- path_doMove
407d66
                ;;
407d66
407d66
            '--delete' )
407d66
                # Remove files and directories from version control.
407d66
                # --- path_doDelete
407d66
                ;;
407d66
    
407d66
            '--sync' )
407d66
                # Syncronize parallel dirctories with parent directory.
407d66
                # --- path_doSync
407d66
                ;;
407d66
407d66
            * )
6ecc07
                cli_printMessage "`gettext "The action provided is not valid."`" 'AsErrorLine'
407d66
                cli_printMessage "$(caller)" 'AsToKnowMoreLine'
407d66
                ;;
407d66
407d66
        esac
407d66
    done
407d66
    
407d66
}