|
|
4c79b5 |
#!/bin/bash
|
|
|
4c79b5 |
#
|
|
|
2bd980 |
# manual_getActions.sh -- This function interpretes arguments passed
|
|
|
2bd980 |
# to `manual' functionality and calls actions accordingly.
|
|
|
4c79b5 |
#
|
|
|
7cd8e9 |
# Copyright (C) 2009, 2010 Alain Reguera Delgado
|
|
|
4c79b5 |
#
|
|
|
7cd8e9 |
# This program is free software; you can redistribute it and/or
|
|
|
7cd8e9 |
# modify it under the terms of the GNU General Public License as
|
|
|
7cd8e9 |
# published by the Free Software Foundation; either version 2 of the
|
|
|
7cd8e9 |
# License, or (at your option) any later version.
|
|
|
4c79b5 |
#
|
|
|
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 |
#
|
|
|
4c79b5 |
# ----------------------------------------------------------------------
|
|
|
418249 |
# $Id$
|
|
|
4c79b5 |
# ----------------------------------------------------------------------
|
|
|
4c79b5 |
|
|
|
4de5d4 |
function manual_getActions {
|
|
|
4c79b5 |
|
|
|
2bd980 |
# Verify language layout.
|
|
|
4de5d4 |
manual_checkLanguageLayout
|
|
|
4c79b5 |
|
|
|
2bd980 |
# Define short options we want to support.
|
|
|
2bd980 |
local ARGSS=""
|
|
|
2bd980 |
|
|
|
2bd980 |
# Define long options we want to support.
|
|
|
2bd980 |
local ARGSL="search:,edit:,delete:,update-output,update-structure:,read:"
|
|
|
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 |
|
|
|
2bd980 |
--search )
|
|
|
2bd980 |
|
|
|
2bd980 |
# Define action value passed through the command-line.
|
|
|
2bd980 |
ACTIONVAL="$2"
|
|
|
2bd980 |
|
|
|
2bd980 |
# Check action value passed through the command-line
|
|
|
2bd980 |
# using source directory definition as reference.
|
|
|
2bd980 |
cli_checkRepoDirSource
|
|
|
2bd980 |
|
|
|
2bd980 |
# Define action name using action value as reference.
|
|
|
2bd980 |
ACTIONNAM="${FUNCNAM}_searchIndex"
|
|
|
2bd980 |
|
|
|
2bd980 |
# Break options loop.
|
|
|
2bd980 |
break
|
|
|
2bd980 |
;;
|
|
|
4c79b5 |
|
|
|
2bd980 |
--edit )
|
|
|
2bd980 |
|
|
|
2bd980 |
# Define action value passed through the command-line.
|
|
|
2bd980 |
ACTIONVAL="$2"
|
|
|
2bd980 |
|
|
|
2bd980 |
# Check action value passed through the command-line
|
|
|
2bd980 |
# using source directory definition as reference.
|
|
|
2bd980 |
cli_checkRepoDirSource
|
|
|
2bd980 |
|
|
|
2bd980 |
# Define action name using action value as reference.
|
|
|
2bd980 |
ACTIONNAM="${FUNCNAM}_editEntry"
|
|
|
2bd980 |
|
|
|
2bd980 |
# Break options loop.
|
|
|
2bd980 |
break
|
|
|
2bd980 |
;;
|
|
|
4c79b5 |
|
|
|
2bd980 |
--delete )
|
|
|
2bd980 |
|
|
|
2bd980 |
# Define action value passed through the command-line.
|
|
|
2bd980 |
ACTIONVAL="$2"
|
|
|
2bd980 |
|
|
|
2bd980 |
# Check action value passed through the command-line
|
|
|
2bd980 |
# using source directory definition as reference.
|
|
|
2bd980 |
cli_checkRepoDirSource
|
|
|
2bd980 |
|
|
|
2bd980 |
# Define action name.
|
|
|
2bd980 |
ACTIONNAM="${FUNCNAM}_removeEntry"
|
|
|
2bd980 |
|
|
|
2bd980 |
# Break options loop.
|
|
|
2bd980 |
break
|
|
|
2bd980 |
;;
|
|
|
4c79b5 |
|
|
|
2bd980 |
--update-output )
|
|
|
2bd980 |
|
|
|
2bd980 |
# Execute action name. There is no need of action
|
|
|
2bd980 |
# value here, so let's execute the action right now.
|
|
|
2bd980 |
manual_updateOutputFiles
|
|
|
2bd980 |
|
|
|
2bd980 |
# Break options loop.
|
|
|
2bd980 |
break
|
|
|
2bd980 |
;;
|
|
|
4c79b5 |
|
|
|
2bd980 |
--update-structure )
|
|
|
2bd980 |
|
|
|
2bd980 |
# Define action value passed through the command-line.
|
|
|
2bd980 |
ACTIONVAL="$2"
|
|
|
2bd980 |
|
|
|
2bd980 |
# Check action value passed through the command-line
|
|
|
2bd980 |
# using source directory definition as reference.
|
|
|
2bd980 |
cli_checkRepoDirSource
|
|
|
2bd980 |
|
|
|
2bd980 |
# Define action name using action value as reference.
|
|
|
2bd980 |
ACTIONNAM="${FUNCNAM}_updateTexinfoStructure"
|
|
|
2bd980 |
|
|
|
2bd980 |
# Break options loop.
|
|
|
2bd980 |
break
|
|
|
2bd980 |
;;
|
|
|
2bd980 |
|
|
|
2bd980 |
--read )
|
|
|
2bd980 |
|
|
|
2bd980 |
# Define action value passed through the command-line.
|
|
|
2bd980 |
ACTIONVAL="$2"
|
|
|
2bd980 |
|
|
|
2bd980 |
# Check action value passed through the command-line
|
|
|
2bd980 |
# using source directory definition as reference.
|
|
|
2bd980 |
cli_checkRepoDirSource
|
|
|
2bd980 |
|
|
|
2bd980 |
# Define action name using action value as reference.
|
|
|
2bd980 |
ACTIONNAM="${FUNCNAM}_searchNode"
|
|
|
2bd980 |
|
|
|
2bd980 |
# Break options loop.
|
|
|
2bd980 |
break
|
|
|
2bd980 |
;;
|
|
|
2bd980 |
|
|
|
2bd980 |
* )
|
|
|
2bd980 |
break
|
|
|
2bd980 |
esac
|
|
|
2bd980 |
done
|
|
|
2bd980 |
|
|
|
2bd980 |
# Verify action value variable.
|
|
|
2bd980 |
if [[ $ACTIONVAL == '' ]];then
|
|
|
2bd980 |
cli_printMessage "$(caller)" 'AsToKnowMoreLine'
|
|
|
2bd980 |
fi
|
|
|
2bd980 |
|
|
|
2bd980 |
# Define documentation entry.
|
|
|
2bd980 |
ENTRY=$(manual_getEntry)
|
|
|
2bd980 |
|
|
|
2bd980 |
# Define directory used to store chapter's documentation entries.
|
|
|
2bd980 |
# At this point, we need to take a desition about
|
|
|
2bd980 |
# documentation-design, in order to answer the question: How do we
|
|
|
2bd980 |
# assign chapters, sections and subsections automatically, based
|
|
|
2bd980 |
# on the repository structure?
|
|
|
2bd980 |
#
|
|
|
2bd980 |
# One solution would be: to use three chapters only to represent
|
|
|
2bd980 |
# the repository's first level structure (i.e., trunk,
|
|
|
2bd980 |
# branches, and tags) and handle everything else as sections. Sub
|
|
|
2bd980 |
# and subsub section will not have their own files, they will be
|
|
|
2bd980 |
# written inside section files instead.
|
|
|
2bd980 |
ENTRYCHAPTER=$(echo $ENTRY | cut -d / -f-10)
|
|
|
2bd980 |
|
|
|
2bd980 |
# Define chapter name for this documentation entry.
|
|
|
2bd980 |
CHAPTERNAME=$(basename $ENTRYCHAPTER)
|
|
|
2bd980 |
|
|
|
2bd980 |
# Execute action name.
|
|
|
2bd980 |
if [[ $ACTIONNAM =~ "^${FUNCNAM}_[A-Za-z]+$" ]];then
|
|
|
2bd980 |
eval $ACTIONNAM
|
|
|
2bd980 |
else
|
|
|
2bd980 |
cli_printMessage "`gettext "A valid action is required."`" 'AsErrorLine'
|
|
|
2bd980 |
cli_printMessage "$(caller)" 'AsToKnowMoreLine'
|
|
|
2bd980 |
fi
|
|
|
4c79b5 |
|
|
|
4c79b5 |
}
|