|
|
4c79b5 |
#!/bin/bash
|
|
|
4c79b5 |
#
|
|
|
522184 |
# help.sh -- This function initializes the interface used by
|
|
|
522184 |
# centos-art.sh script to perform documentation tasks through
|
|
|
522184 |
# different documentation backends.
|
|
|
4c79b5 |
#
|
|
|
3b0984 |
# Copyright (C) 2009, 2010, 2011 The CentOS Artwork SIG
|
|
|
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
|
|
|
b0e781 |
# the Free Software Foundation; either version 2 of the License, or
|
|
|
b0e781 |
# (at your option) any later version.
|
|
|
fa95b1 |
#
|
|
|
74a058 |
# This program is distributed in the hope that it will be useful, but
|
|
|
74a058 |
# 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
|
|
|
dcd347 |
# Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
|
|
|
7ac5a5 |
#
|
|
|
4c79b5 |
# ----------------------------------------------------------------------
|
|
|
418249 |
# $Id$
|
|
|
4c79b5 |
# ----------------------------------------------------------------------
|
|
|
4c79b5 |
|
|
|
0211a4 |
function help {
|
|
|
2bd980 |
|
|
|
edaa9d |
# Initialize action name with an empty value.
|
|
|
c145a8 |
local ACTIONNAM=''
|
|
|
c145a8 |
|
|
|
771ff2 |
# Initialize search option (`--search'). This option is used to
|
|
|
771ff2 |
# look for documentation inside documentation backends.
|
|
|
6150a1 |
local FLAG_SEARCH=""
|
|
|
1b527b |
|
|
|
edaa9d |
# Initialize the backend flag (`--backend'). This option sets the
|
|
|
edaa9d |
# documentation backed used to perform documentation actions.
|
|
|
edaa9d |
local FLAG_BACKEND='texinfo'
|
|
|
09b4e0 |
|
|
|
6150a1 |
# Initialize manual's language.
|
|
|
6150a1 |
local MANUAL_L10N=$(cli_getCurrentLocale)
|
|
|
771ff2 |
|
|
|
edaa9d |
# Initialize arrays related to documentation entries. Arrays
|
|
|
edaa9d |
# defined here contain all the information needed to process
|
|
|
edaa9d |
# documentation entries written in texinfo format.
|
|
|
edaa9d |
local -a MANUAL_SLFN
|
|
|
edaa9d |
local -a MANUAL_DIRN
|
|
|
edaa9d |
local -a MANUAL_CHAN
|
|
|
edaa9d |
local -a MANUAL_SECN
|
|
|
edaa9d |
|
|
|
edaa9d |
# Initialize counter of non-option arguments.
|
|
|
edaa9d |
local MANUAL_DOCENTRY_COUNT=0
|
|
|
edaa9d |
local MANUAL_DOCENTRY_ID=0
|
|
|
771ff2 |
|
|
|
0c5b48 |
# Interpret option arguments passed through the command-line.
|
|
|
0c5b48 |
${FUNCNAM}_getOptions
|
|
|
116f45 |
|
|
|
edaa9d |
# Redefine arrays related to documentation entries using
|
|
|
edaa9d |
# non-option arguments passed through the command-line. At this
|
|
|
edaa9d |
# point all options have been removed from ARGUMENTS and
|
|
|
edaa9d |
# non-option arguments remain. Evaluate ARGUMENTS to retrive the
|
|
|
edaa9d |
# information related documentation entries from there.
|
|
|
edaa9d |
${FUNCNAM}_getEntries
|
|
|
6150a1 |
|
|
|
edaa9d |
# Syncronize changes between repository and working copy. At this
|
|
|
edaa9d |
# point, changes in the repository are merged in the working copy
|
|
|
edaa9d |
# and changes in the working copy committed up to repository.
|
|
|
edaa9d |
cli_syncroRepoChanges ${MANUAL_BASEDIR}
|
|
|
23c4a7 |
|
|
|
edaa9d |
# Initialize backend functionalities. At this point we load all
|
|
|
edaa9d |
# functionalities required into the centos-art.sh's execution
|
|
|
edaa9d |
# environment and make them available, this way, to perform
|
|
|
edaa9d |
# backend-specific documentation tasks.
|
|
|
522184 |
cli_exportFunctions "${FUNCDIR}/${FUNCDIRNAM}/$(cli_getRepoName \
|
|
|
edaa9d |
${FLAG_BACKEND} -d)" "${FLAG_BACKEND}"
|
|
|
edaa9d |
|
|
|
edaa9d |
# Execute backend-specific documentation tasks for each
|
|
|
edaa9d |
# documentation entry specified in the command-line, individually.
|
|
|
edaa9d |
# Notice that we've stored all documentation entries passed as
|
|
|
edaa9d |
# non-option arguments in array variables in order to process them
|
|
|
edaa9d |
# now, one by one. This is particularily useful when we need to
|
|
|
edaa9d |
# reach items in the array beyond the current iteration cycle. For
|
|
|
edaa9d |
# example, when we perform actions that require source and target
|
|
|
edaa9d |
# locations (e.g., copying and renaming): we use the current value
|
|
|
edaa9d |
# as source location and the second value in the array as target
|
|
|
edaa9d |
# location; both defined from the first iteration cycle.
|
|
|
edaa9d |
while [[ $MANUAL_DOCENTRY_ID -lt $MANUAL_DOCENTRY_COUNT ]];do
|
|
|
edaa9d |
|
|
|
edaa9d |
# Define name used by manual's main definition file.
|
|
|
edaa9d |
MANUAL_NAME=${MANUAL_SLFN[${MANUAL_DOCENTRY_ID}]}
|
|
|
edaa9d |
|
|
|
edaa9d |
# Define absolute path to directory holding manual's main
|
|
|
edaa9d |
# definition file.
|
|
|
edaa9d |
MANUAL_TLDIR="${HOME}/artwork/branches/Manuals/$(cli_getRepoName \
|
|
|
edaa9d |
${FLAG_BACKEND} -d)/${MANUAL_DIRN[${MANUAL_DOCENTRY_ID}]}"
|
|
|
edaa9d |
|
|
|
edaa9d |
# Define chapter name.
|
|
|
edaa9d |
MANUAL_CHAPTER_NAME=${MANUAL_CHAN[${MANUAL_DOCENTRY_ID}]}
|
|
|
edaa9d |
|
|
|
edaa9d |
# Define section name.
|
|
|
edaa9d |
MANUAL_SECTION_NAME=${MANUAL_SECN[${MANUAL_DOCENTRY_ID}]}
|
|
|
edaa9d |
|
|
|
edaa9d |
# Execute backend-specific documentation tasks.
|
|
|
edaa9d |
${FLAG_BACKEND}
|
|
|
edaa9d |
|
|
|
edaa9d |
# Increment documentation entry counter id.
|
|
|
edaa9d |
MANUAL_DOCENTRY_ID=$(($MANUAL_DOCENTRY_ID + 1))
|
|
|
edaa9d |
|
|
|
edaa9d |
done
|
|
|
edaa9d |
|
|
|
edaa9d |
# Rebuild output files to propagate recent changes.
|
|
|
edaa9d |
${FLAG_BACKEND}_updateOutputFiles
|
|
|
23c4a7 |
|
|
|
edaa9d |
# Commit changes from working copy to central repository only. At
|
|
|
edaa9d |
# this point, changes in the repository are not merged in the
|
|
|
edaa9d |
# working copy, but chages in the working copy do are committed up
|
|
|
edaa9d |
# to repository.
|
|
|
edaa9d |
cli_commitRepoChanges ${MANUAL_BASEDIR}
|
|
|
c145a8 |
|
|
|
23c4a7 |
}
|