|
|
878a2b |
#!/bin/bash
|
|
|
878a2b |
#
|
|
|
878a2b |
# help_getOptions.sh -- This function interpretes option arguments
|
|
|
878a2b |
# passed to `help' functionality through the command-line and defines
|
|
|
878a2b |
# action names accordingly.
|
|
|
878a2b |
#
|
|
|
03486a |
# Copyright (C) 2009, 2010, 2011, 2012 The CentOS Project
|
|
|
878a2b |
#
|
|
|
878a2b |
# This program is free software; you can redistribute it and/or modify
|
|
|
878a2b |
# it under the terms of the GNU General Public License as published by
|
|
|
878a2b |
# the Free Software Foundation; either version 2 of the License, or (at
|
|
|
878a2b |
# your option) any later version.
|
|
|
878a2b |
#
|
|
|
878a2b |
# This program is distributed in the hope that it will be useful, but
|
|
|
878a2b |
# WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
|
878a2b |
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
|
|
878a2b |
# General Public License for more details.
|
|
|
878a2b |
#
|
|
|
878a2b |
# You should have received a copy of the GNU General Public License
|
|
|
878a2b |
# along with this program; if not, write to the Free Software
|
|
|
878a2b |
# Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
|
|
|
878a2b |
#
|
|
|
878a2b |
# ----------------------------------------------------------------------
|
|
|
878a2b |
# $Id$
|
|
|
878a2b |
# ----------------------------------------------------------------------
|
|
|
878a2b |
|
|
|
878a2b |
function help_getOptions {
|
|
|
878a2b |
|
|
|
878a2b |
# Define short options we want to support.
|
|
|
55b84d |
local ARGSS="h,q"
|
|
|
878a2b |
|
|
|
878a2b |
# Define long options we want to support.
|
|
|
55b84d |
local ARGSL="help,quiet,answer-yes,read,search:,format:,edit,update-output,update-structure,copy,delete,rename,sync-changes"
|
|
|
878a2b |
|
|
|
0d0afb |
# Redefine ARGUMENTS using getopt(1) command parser.
|
|
|
878a2b |
cli_parseArguments
|
|
|
878a2b |
|
|
|
878a2b |
# Reset positional parameters using output from (getopt) argument
|
|
|
878a2b |
# parser.
|
|
|
878a2b |
eval set -- "$ARGUMENTS"
|
|
|
878a2b |
|
|
|
878a2b |
# Define action to take for each option passed.
|
|
|
878a2b |
while true; do
|
|
|
878a2b |
case "$1" in
|
|
|
878a2b |
|
|
|
e9809e |
-h | --help )
|
|
|
819c26 |
cli_runFnEnvironment help --read --format="texinfo" Scripts/Bash/Functions/Help
|
|
|
e9809e |
shift 1
|
|
|
e9809e |
exit
|
|
|
e9809e |
;;
|
|
|
e9809e |
|
|
|
7d52c6 |
-q | --quiet )
|
|
|
7d52c6 |
FLAG_QUIET="true"
|
|
|
878a2b |
shift 1
|
|
|
878a2b |
;;
|
|
|
878a2b |
|
|
|
878a2b |
--answer-yes )
|
|
|
878a2b |
FLAG_ANSWER="true"
|
|
|
878a2b |
shift 1
|
|
|
878a2b |
;;
|
|
|
878a2b |
|
|
|
55b84d |
--sync-changes )
|
|
|
55b84d |
FLAG_SYNC_CHANGES="true"
|
|
|
55b84d |
shift 1
|
|
|
55b84d |
;;
|
|
|
55b84d |
|
|
|
878a2b |
--search )
|
|
|
878a2b |
ACTIONNAM="searchIndex"
|
|
|
878a2b |
FLAG_SEARCH="$2"
|
|
|
878a2b |
shift 2
|
|
|
878a2b |
;;
|
|
|
c594b0 |
|
|
|
c594b0 |
--format )
|
|
|
c594b0 |
FLAG_FORMAT=$(cli_getRepoName "$2" -f)
|
|
|
a6e1b4 |
# Verify supported documentation manual formats. This
|
|
|
a6e1b4 |
# is required in order to prevent building paths to
|
|
|
a6e1b4 |
# non-existent documentation structures.
|
|
|
a6e1b4 |
if [[ ! $FLAG_FORMAT =~ '^(texinfo)$' ]];then
|
|
|
a6e1b4 |
cli_printMessage "`gettext "The documentation format provided is not supported."`" --as-error-line
|
|
|
a6e1b4 |
fi
|
|
|
c594b0 |
shift 2
|
|
|
c594b0 |
;;
|
|
|
55b84d |
|
|
|
55b84d |
--read )
|
|
|
55b84d |
ACTIONNAM="searchNode"
|
|
|
55b84d |
shift 1
|
|
|
55b84d |
;;
|
|
|
878a2b |
|
|
|
878a2b |
--edit )
|
|
|
878a2b |
ACTIONNAM="editEntry"
|
|
|
878a2b |
shift 1
|
|
|
878a2b |
;;
|
|
|
878a2b |
|
|
|
878a2b |
--copy )
|
|
|
878a2b |
ACTIONNAM="copyEntry"
|
|
|
878a2b |
shift 1
|
|
|
878a2b |
;;
|
|
|
878a2b |
|
|
|
878a2b |
--delete )
|
|
|
878a2b |
ACTIONNAM="deleteEntry"
|
|
|
878a2b |
shift 1
|
|
|
878a2b |
;;
|
|
|
878a2b |
|
|
|
878a2b |
--rename )
|
|
|
878a2b |
ACTIONNAM="renameEntry"
|
|
|
878a2b |
shift 1
|
|
|
878a2b |
;;
|
|
|
878a2b |
|
|
|
55b84d |
--update-output )
|
|
|
55b84d |
ACTIONNAM="updateOutputFiles"
|
|
|
0d0afb |
shift 1
|
|
|
0d0afb |
;;
|
|
|
0d0afb |
|
|
|
ad2fdc |
--update-structure )
|
|
|
ad2fdc |
ACTIONNAM="updateStructureSection"
|
|
|
ad2fdc |
shift 1
|
|
|
ad2fdc |
;;
|
|
|
ad2fdc |
|
|
|
878a2b |
-- )
|
|
|
878a2b |
# Remove the `--' argument from the list of arguments
|
|
|
878a2b |
# in order for processing non-option arguments
|
|
|
878a2b |
# correctly. At this point all option arguments have
|
|
|
878a2b |
# been processed already but the `--' argument still
|
|
|
878a2b |
# remains to mark ending of option arguments and
|
|
|
ad2fdc |
# beginning of non-option arguments. The `--' argument
|
|
|
878a2b |
# needs to be removed here in order to avoid
|
|
|
878a2b |
# centos-art.sh script to process it as a path inside
|
|
|
878a2b |
# the repository, which obviously is not.
|
|
|
878a2b |
shift 1
|
|
|
878a2b |
break
|
|
|
878a2b |
;;
|
|
|
878a2b |
esac
|
|
|
878a2b |
done
|
|
|
878a2b |
|
|
|
878a2b |
# Redefine ARGUMENTS variable using current positional parameters.
|
|
|
878a2b |
cli_parseArgumentsReDef "$@"
|
|
|
878a2b |
|
|
|
878a2b |
}
|