|
|
4c79b5 |
#!/bin/bash
|
|
|
4c79b5 |
#
|
|
|
0211a4 |
# help.sh -- This function provides documentation features to
|
|
|
4c79b5 |
# centos-art.sh script. Here we initialize documentation variables and
|
|
|
0211a4 |
# call help_getArguments functions.
|
|
|
4c79b5 |
#
|
|
|
9f5f2e |
# Copyright (C) 2009-2011 Alain Reguera Delgado
|
|
|
fa95b1 |
#
|
|
|
fa95b1 |
# This program is free software; you can redistribute it and/or modify
|
|
|
fa95b1 |
|
|
|
dcd347 |
|
|
|
dcd347 |
|
|
|
fa95b1 |
#
|
|
|
74a058 |
|
|
|
74a058 |
|
|
|
4c79b5 |
|
|
|
4c79b5 |
# General Public License for more details.
|
|
|
4c79b5 |
#
|
|
|
4c79b5 |
|
|
|
4c79b5 |
# along with this program; if not, write to the Free Software
|
|
|
dcd347 |
# Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
|
|
|
4c79b5 |
# ----------------------------------------------------------------------
|
|
|
418249 |
# $Id$
|
|
|
4c79b5 |
# ----------------------------------------------------------------------
|
|
|
4c79b5 |
|
|
|
0211a4 |
function help {
|
|
|
2bd980 |
|
|
|
c145a8 |
local ACTIONNAM=''
|
|
|
c145a8 |
local ACTIONVAL=''
|
|
|
5ec287 |
local -a ACTIONVALS
|
|
|
c145a8 |
|
|
|
5285d6 |
|
|
|
5285d6 |
|
|
|
5285d6 |
|
|
|
459a8c |
MANUAL_BASEDIR="${HOME}/artwork/trunk/Manual"
|
|
|
5285d6 |
|
|
|
1f6dd8 |
|
|
|
1f6dd8 |
|
|
|
69150d |
MANUAL_NAME=repository
|
|
|
1f6dd8 |
|
|
|
1f6dd8 |
|
|
|
1f6dd8 |
|
|
|
1f6dd8 |
# related files (.info, .pdf, .xml, etc.).
|
|
|
1f6dd8 |
MANUAL_BASEFILE="${MANUAL_BASEDIR}/${MANUAL_NAME}"
|
|
|
1f6dd8 |
|
|
|
5ec287 |
# Interpret option arguments passed through command-line.
|
|
|
5ec287 |
help_getOptions
|
|
|
c145a8 |
|
|
|
c145a8 |
# Redefine positional parameters using ARGUMENTS. At this point,
|
|
|
c145a8 |
|
|
|
c145a8 |
|
|
|
c145a8 |
eval set -- "$ARGUMENTS"
|
|
|
c145a8 |
|
|
|
5ec287 |
|
|
|
5ec287 |
|
|
|
5ec287 |
|
|
|
5ec287 |
|
|
|
5ec287 |
|
|
|
5ec287 |
|
|
|
5ec287 |
for ACTIONVAL in "$@";do
|
|
|
5ec287 |
ACTIONVALS[((++${#ACTIONVALS[*]}))]="$ACTIONVAL"
|
|
|
5ec287 |
done
|
|
|
5ec287 |
|
|
|
5ec287 |
|
|
|
5ec287 |
|
|
|
5ec287 |
if [[ ${ACTIONNAM} == ${FUNCNAM}_copyEntry ]];then
|
|
|
5ec287 |
|
|
|
5ec287 |
|
|
|
5ec287 |
|
|
|
5ec287 |
|
|
|
5ec287 |
|
|
|
5ec287 |
|
|
|
5ec287 |
|
|
|
5ec287 |
|
|
|
5ec287 |
local -a ENTRY_SRC
|
|
|
5ec287 |
local ENTRY_DST=''
|
|
|
5ec287 |
local COUNT=0
|
|
|
5ec287 |
|
|
|
5ec287 |
# Define list of source locations using remaining arguments.
|
|
|
5ec287 |
while [[ ${COUNT} -lt $((${#ACTIONVALS[*]} - 1)) ]];do
|
|
|
5ec287 |
ENTRY_SRC[((++${#ENTRY_SRC[*]}))]=${ACTIONVALS[$COUNT]}
|
|
|
5ec287 |
COUNT=$(($COUNT + 1))
|
|
|
5ec287 |
done
|
|
|
5ec287 |
|
|
|
5ec287 |
|
|
|
5ec287 |
ENTRY_DST=$(cli_checkRepoDirTarget "${ACTIONVALS[((${#ACTIONVALS[*]} - 1))]}")
|
|
|
5ec287 |
|
|
|
5ec287 |
|
|
|
5ec287 |
ENTRY_DST=$(help_getEntry "$ENTRY_DST")
|
|
|
5ec287 |
|
|
|
5ec287 |
|
|
|
5ec287 |
ARGUMENTS=${ENTRY_SRC[@]}
|
|
|
5ec287 |
|
|
|
5ec287 |
elif [[ ${ACTIONNAM} == ${FUNCNAM}_renameEntry ]];then
|
|
|
5ec287 |
|
|
|
5ec287 |
|
|
|
5ec287 |
|
|
|
5ec287 |
|
|
|
5ec287 |
|
|
|
5ec287 |
|
|
|
5ec287 |
local ENTRY_SRC=''
|
|
|
5ec287 |
local ENTRY_DST=''
|
|
|
5ec287 |
|
|
|
5ec287 |
|
|
|
5ec287 |
if [[ ${#ACTIONVALS[*]} -gt 2 ]];then
|
|
|
5ec287 |
cli_printMessage "`gettext "Only two arguments are accepted."`" 'AsErrorLine'
|
|
|
5ec287 |
cli_printMessage "${FUNCDIRNAME}" 'AsToKnowMoreLine'
|
|
|
5ec287 |
elif [[ ${#ACTIONVALS[*]} -lt 2 ]];then
|
|
|
5ec287 |
cli_printMessage "`gettext "Two arguments are required."`" 'AsErrorLine'
|
|
|
5ec287 |
cli_printMessage "${FUNCDIRNAME}" 'AsToKnowMoreLine'
|
|
|
5ec287 |
fi
|
|
|
5ec287 |
|
|
|
5ec287 |
|
|
|
5ec287 |
ENTRY_SRC=${ACTIONVALS[0]}
|
|
|
5ec287 |
|
|
|
5ec287 |
|
|
|
5ec287 |
ENTRY_DST=$(cli_checkRepoDirTarget "${ACTIONVALS[1]}")
|
|
|
5ec287 |
|
|
|
5ec287 |
|
|
|
5ec287 |
ENTRY_DST=$(help_getEntry "${ACTIONVALS[1]}")
|
|
|
5ec287 |
|
|
|
5ec287 |
|
|
|
5ec287 |
ARGUMENTS=$ENTRY_SRC
|
|
|
5ec287 |
|
|
|
5ec287 |
else
|
|
|
5ec287 |
|
|
|
5ec287 |
|
|
|
5ec287 |
ARGUMENTS=$@
|
|
|
5ec287 |
|
|
|
5ec287 |
fi
|
|
|
5ec287 |
|
|
|
6cda26 |
|
|
|
6cda26 |
|
|
|
6cda26 |
|
|
|
0211a4 |
|
|
|
6cda26 |
|
|
|
6cda26 |
|
|
|
6cda26 |
|
|
|
6cda26 |
|
|
|
5ec287 |
for ACTIONVAL in $ARGUMENTS;do
|
|
|
c145a8 |
|
|
|
c145a8 |
|
|
|
c145a8 |
|
|
|
c145a8 |
cli_checkRepoDirSource
|
|
|
c145a8 |
|
|
|
c145a8 |
|
|
|
0211a4 |
ENTRY=$(help_getEntry)
|
|
|
c145a8 |
|
|
|
c145a8 |
|
|
|
c145a8 |
|
|
|
c145a8 |
ENTRY_DIR=$(dirname ${ENTRY} | sed -r 's!\.texi$!!')
|
|
|
c145a8 |
|
|
|
c145a8 |
|
|
|
c145a8 |
ENTRY_FILE=$(basename ${ENTRY} | sed -r 's!\.texi$!!')
|
|
|
c145a8 |
|
|
|
c145a8 |
|
|
|
c145a8 |
|
|
|
c145a8 |
|
|
|
c145a8 |
|
|
|
c145a8 |
|
|
|
c145a8 |
|
|
|
c145a8 |
|
|
|
c145a8 |
|
|
|
0b20e8 |
|
|
|
0b20e8 |
|
|
|
0b20e8 |
|
|
|
0b20e8 |
|
|
|
0b20e8 |
|
|
|
459a8c |
MANUAL_CHAPTER_DIR=$(echo $ENTRY | cut -d / -f-7)
|
|
|
c145a8 |
|
|
|
c145a8 |
|
|
|
c145a8 |
|
|
|
c145a8 |
MANUAL_CHAPTER_NAME=$(basename "$MANUAL_CHAPTER_DIR")
|
|
|
c145a8 |
|
|
|
c145a8 |
|
|
|
c145a8 |
cli_printActionPreamble "${MANUAL_BASEFILE}.texi" '' ''
|
|
|
c145a8 |
|
|
|
c145a8 |
|
|
|
c145a8 |
|
|
|
c145a8 |
|
|
|
c145a8 |
|
|
|
0b20e8 |
cli_syncroRepoChanges ${MANUAL_CHAPTER_DIR}
|
|
|
c145a8 |
|
|
|
c145a8 |
|
|
|
c145a8 |
if [[ $ACTIONNAM =~ "^${FUNCNAM}_[A-Za-z]+$" ]];then
|
|
|
c145a8 |
eval $ACTIONNAM
|
|
|
c145a8 |
else
|
|
|
c145a8 |
cli_printMessage "`gettext "A valid action is required."`" 'AsErrorLine'
|
|
|
eee226 |
cli_printMessage "${FUNCDIRNAM}" 'AsToKnowMoreLine'
|
|
|
c145a8 |
fi
|
|
|
638bf8 |
|
|
|
c145a8 |
|
|
|
c145a8 |
|
|
|
c145a8 |
|
|
|
c145a8 |
|
|
|
0b20e8 |
cli_commitRepoChanges ${MANUAL_CHAPTER_DIR}
|
|
|
4c79b5 |
|
|
|
c145a8 |
done
|
|
|
4c79b5 |
}
|