|
|
4c79b5 |
#!/bin/bash
|
|
|
4c79b5 |
#
|
|
|
0211a4 |
# help_getArguments.sh -- This function interpretes arguments passed
|
|
|
2bd980 |
# to `manual' functionality and calls actions accordingly.
|
|
|
4c79b5 |
#
|
|
|
9f5f2e |
# 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 |
#
|
|
|
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 |
# ----------------------------------------------------------------------
|
|
|
418249 |
# $Id$
|
|
|
4c79b5 |
# ----------------------------------------------------------------------
|
|
|
4c79b5 |
|
|
|
0211a4 |
function help_getArguments {
|
|
|
4c79b5 |
|
|
|
2bd980 |
# Define short options we want to support.
|
|
|
2bd980 |
local ARGSS=""
|
|
|
2bd980 |
|
|
|
2bd980 |
# Define long options we want to support.
|
|
|
75af33 |
local ARGSL="filter:,quiet,answer:,dont-commit-changes,read,search,edit,update"
|
|
|
2bd980 |
|
|
|
2bd980 |
# Parse arguments using getopt(1) command parser.
|
|
|
2bd980 |
cli_doParseArguments
|
|
|
2bd980 |
|
|
|
2bd980 |
# Reset positional parameters using output from (getopt) argument
|
|
|
2bd980 |
# parser.
|
|
|
2bd980 |
eval set -- "$ARGUMENTS"
|
|
|
2bd980 |
|
|
|
2bd980 |
# Define action to take for each option passed.
|
|
|
2bd980 |
while true; do
|
|
|
2bd980 |
case "$1" in
|
|
|
2bd980 |
|
|
|
c145a8 |
--filter )
|
|
|
c145a8 |
FLAG_FILTER="$2"
|
|
|
c145a8 |
shift 2
|
|
|
c145a8 |
;;
|
|
|
c145a8 |
|
|
|
c145a8 |
--quiet )
|
|
|
c145a8 |
FLAG_QUIET="true"
|
|
|
c145a8 |
FLAG_DONT_COMMIT_CHANGES="true"
|
|
|
c145a8 |
shift 1
|
|
|
c145a8 |
;;
|
|
|
c145a8 |
|
|
|
c145a8 |
--answer )
|
|
|
c145a8 |
FLAG_ANSWER="$2"
|
|
|
c145a8 |
shift 2
|
|
|
c145a8 |
;;
|
|
|
c145a8 |
|
|
|
c145a8 |
--dont-commit-changes )
|
|
|
c145a8 |
FLAG_DONT_COMMIT_CHANGES="true"
|
|
|
c145a8 |
shift 1
|
|
|
c145a8 |
;;
|
|
|
c145a8 |
|
|
|
638bf8 |
--search )
|
|
|
2bd980 |
ACTIONNAM="${FUNCNAM}_searchIndex"
|
|
|
c145a8 |
shift 1
|
|
|
2bd980 |
;;
|
|
|
4c79b5 |
|
|
|
2bd980 |
--edit )
|
|
|
2bd980 |
ACTIONNAM="${FUNCNAM}_editEntry"
|
|
|
c145a8 |
shift 1
|
|
|
2bd980 |
;;
|
|
|
4c79b5 |
|
|
|
638bf8 |
--update )
|
|
|
5285d6 |
ACTIONNAM="${FUNCNAM}_updateOutputFiles"
|
|
|
c145a8 |
shift 1
|
|
|
2bd980 |
;;
|
|
|
4c79b5 |
|
|
|
961d96 |
--read )
|
|
|
bbb90e |
ACTIONNAM="${FUNCNAM}_searchNode"
|
|
|
bbb90e |
FLAG_DONT_COMMIT_CHANGES='true'
|
|
|
961d96 |
shift 1
|
|
|
961d96 |
;;
|
|
|
961d96 |
|
|
|
961d96 |
-- )
|
|
|
961d96 |
# Remove the `--' argument from the list of arguments
|
|
|
961d96 |
# in order for processing non-option arguments
|
|
|
961d96 |
# correctly. At this point all option arguments have
|
|
|
961d96 |
# been processed already but the `--' argument still
|
|
|
961d96 |
# remains to mark ending of option arguments and
|
|
|
961d96 |
# begining of non-option arguments. The `--' argument
|
|
|
961d96 |
# needs to be removed here in order to avoid
|
|
|
961d96 |
# centos-art.sh script to process it as a path inside
|
|
|
961d96 |
# the repository, which obviously is not.
|
|
|
961d96 |
shift 1
|
|
|
2bd980 |
break
|
|
|
bbb90e |
;;
|
|
|
2bd980 |
esac
|
|
|
2bd980 |
done
|
|
|
2bd980 |
|
|
|
961d96 |
# Define default action for help functionality. This is, the
|
|
|
961d96 |
# action performed when no non-option argument is passed to
|
|
|
961d96 |
# centos-art.sh script command-line internface.
|
|
|
961d96 |
if [[ $# -eq 0 ]];then
|
|
|
961d96 |
/usr/bin/info --node="Top" --file=${MANUAL_BASEFILE}.info.bz2
|
|
|
961d96 |
exit
|
|
|
961d96 |
fi
|
|
|
961d96 |
|
|
|
c145a8 |
# Redefine ARGUMENTS variable using current positional parameters.
|
|
|
c145a8 |
cli_doParseArgumentsReDef "$@"
|
|
|
b88dec |
|
|
|
4c79b5 |
}
|