Blame Scripts/Functions/About/about_getActions.sh

edc7d9
#!/bin/bash
edc7d9
#
323d8b
# about_getActions.sh -- This function interpretes arguments passed to
323d8b
# about functionality and calls actions accordingly.
edc7d9
#
473e51
# Copyright (C) 2009-2011 Alain Reguera Delgado
fa95b1
#
fa95b1
# This program is free software; you can redistribute it and/or modify
fa95b1
# it under the terms of the GNU General Public License as published by
fa95b1
# the Free Software Foundation; either version 2 of the License, or
fa95b1
# (at your option) any later version.
fa95b1
#
edc7d9
# This program is distributed in the hope that it will be useful, but
edc7d9
# WITHOUT ANY WARRANTY; without even the implied warranty of
edc7d9
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
edc7d9
# General Public License for more details.
edc7d9
#
edc7d9
# You should have received a copy of the GNU General Public License
edc7d9
# along with this program; if not, write to the Free Software
edc7d9
# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
edc7d9
# USA.
edc7d9
# ----------------------------------------------------------------------
651f7f
# $Id$
edc7d9
# ----------------------------------------------------------------------
edc7d9
    
429ced
function about_getActions {
edc7d9
323d8b
    # Define short options we want to support.
323d8b
    local ARGSS=""
323d8b
323d8b
    # Define long options we want to support.
323d8b
    local ARGSL="license,history,authors,copying"
323d8b
323d8b
    # Parse arguments using getopt(1) command parser.
323d8b
    cli_doParseArguments
323d8b
323d8b
    # Reset positional parameters using output from (getopt) argument
323d8b
    # parser.
323d8b
    eval set -- "$ARGUMENTS"
323d8b
323d8b
    # Look for options passed through command-line.
323d8b
    while true; do
323d8b
        case "$1" in
323d8b
323d8b
            --license )
323d8b
                ACTIONVAL="${FUNCCONFIG}/license.txt"
323d8b
                break
323d8b
                ;;
323d8b
323d8b
            --history )
323d8b
                ACTIONVAL="${FUNCCONFIG}/history.txt"
323d8b
                break
323d8b
                ;;
323d8b
323d8b
            --authors )
323d8b
                ACTIONVAL="${FUNCCONFIG}/authors.txt"
323d8b
                break
323d8b
                ;;
323d8b
85972f
            --copying | * )
323d8b
                ACTIONVAL="${FUNCCONFIG}/copying.txt"
323d8b
                break
323d8b
                ;;
323d8b
323d8b
        esac
323d8b
    done
323d8b
323d8b
    # Execute action name.
323d8b
    if [[ -f $ACTIONVAL ]];then
323d8b
        less $ACTIONVAL
323d8b
    else
323d8b
        cli_printMessage "`gettext "A valid action is required."`" 'AsErrorLine'
eee226
        cli_printMessage "${FUNCDIRNAM}" 'AsToKnowMoreLine'
323d8b
    fi
12241f
edc7d9
}