|
|
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 |
# 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 {
|
|
|
2bd980 |
|
|
|
c145a8 |
local ACTIONNAM=''
|
|
|
c145a8 |
local ACTIONVAL=''
|
|
|
c145a8 |
|
|
|
5285d6 |
# Define manuals base directory. This is the place where
|
|
|
5285d6 |
# documentation manuals base directory structures are stored and
|
|
|
5285d6 |
# organized in.
|
|
|
8bcc5c |
MANUAL_BASEDIR="${HOME}/artwork/trunk/Identity/Manual"
|
|
|
5285d6 |
|
|
|
1f6dd8 |
# Define file name for documentation manual. This is the file used
|
|
|
1f6dd8 |
# to initiate the structure of documentation manual.
|
|
|
69150d |
MANUAL_NAME=repository
|
|
|
1f6dd8 |
|
|
|
1f6dd8 |
# Define base name for documentation manual files (without
|
|
|
1f6dd8 |
# extension). This is the main file name used to build texinfo
|
|
|
1f6dd8 |
# related files (.info, .pdf, .xml, etc.).
|
|
|
1f6dd8 |
MANUAL_BASEFILE="${MANUAL_BASEDIR}/${MANUAL_NAME}"
|
|
|
1f6dd8 |
|
|
|
c145a8 |
# Interpret arguments and options passed through command-line.
|
|
|
0211a4 |
help_getArguments
|
|
|
c145a8 |
|
|
|
c145a8 |
# Redefine positional parameters using ARGUMENTS. At this point,
|
|
|
c145a8 |
# option arguments have been removed from ARGUMENTS variable and
|
|
|
c145a8 |
# only non-option arguments remain in it.
|
|
|
c145a8 |
eval set -- "$ARGUMENTS"
|
|
|
c145a8 |
|
|
|
6cda26 |
# Define action name. It does matter what option be passed to
|
|
|
6cda26 |
# centos-art, there are many different actions to perform based on
|
|
|
6cda26 |
# the option passed (e.g., `--edit', `--read', `--search', etc.).
|
|
|
0211a4 |
# In that sake, we defined action name inside help_getArguments,
|
|
|
6cda26 |
# at the moment of interpreting options.
|
|
|
6cda26 |
|
|
|
6cda26 |
# Define action value. As convenction, we use non-option arguments
|
|
|
6cda26 |
# to define the action value (ACTIONVAL) variable.
|
|
|
c145a8 |
for ACTIONVAL in "$@";do
|
|
|
c145a8 |
|
|
|
c145a8 |
# Check action value passed through the command-line using
|
|
|
c145a8 |
# source directory definition as reference.
|
|
|
c145a8 |
cli_checkRepoDirSource
|
|
|
c145a8 |
|
|
|
c145a8 |
# Define documentation entry.
|
|
|
0211a4 |
ENTRY=$(help_getEntry)
|
|
|
c145a8 |
|
|
|
c145a8 |
# Define documentation entry directory. This is the directory
|
|
|
c145a8 |
# where the entry file is stored.
|
|
|
c145a8 |
ENTRY_DIR=$(dirname ${ENTRY} | sed -r 's!\.texi$!!')
|
|
|
c145a8 |
|
|
|
c145a8 |
# Define documentation entry file (without extension).
|
|
|
c145a8 |
ENTRY_FILE=$(basename ${ENTRY} | sed -r 's!\.texi$!!')
|
|
|
c145a8 |
|
|
|
c145a8 |
# Define directory to store documentation entries. At this
|
|
|
c145a8 |
# point, we need to take a desition about documentation
|
|
|
c145a8 |
# design, in order to answer the question: How do we assign
|
|
|
c145a8 |
# chapters, sections and subsections automatically, based on
|
|
|
c145a8 |
# the repository structure? and also, how such design could
|
|
|
c145a8 |
# be adapted to changes in the repository structure?
|
|
|
c145a8 |
#
|
|
|
c145a8 |
# One solution would be: represent the repository's directory
|
|
|
c145a8 |
# structure as sections inside a chapter named Filesystem or
|
|
|
c145a8 |
# something similar. Subsections and subsubsections will not
|
|
|
c145a8 |
# have their own files, they all will be written inside the
|
|
|
c145a8 |
# same section file that represents the repository directory.
|
|
|
c145a8 |
MANUAL_CHAPTER_DIR=$(echo $ENTRY | cut -d / -f-7)
|
|
|
c145a8 |
|
|
|
c145a8 |
# Define chapter name for the documentation entry we are
|
|
|
c145a8 |
# working with.
|
|
|
c145a8 |
MANUAL_CHAPTER_NAME=$(basename "$MANUAL_CHAPTER_DIR")
|
|
|
c145a8 |
|
|
|
c145a8 |
# Set action preable.
|
|
|
c145a8 |
cli_printActionPreamble "${MANUAL_BASEFILE}.texi" '' ''
|
|
|
c145a8 |
|
|
|
c145a8 |
# Syncronize changes between repository and working copy. At
|
|
|
c145a8 |
# this point, changes in the repository are merged in the
|
|
|
c145a8 |
# working copy and changes in the working copy committed up to
|
|
|
c145a8 |
# repository.
|
|
|
c145a8 |
cli_syncroRepoChanges ${MANUAL_BASEDIR}
|
|
|
c145a8 |
|
|
|
c145a8 |
# Execute action name.
|
|
|
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 |
# Commit changes from working copy to central repository only.
|
|
|
c145a8 |
# At this point, changes in the repository are not merged in
|
|
|
c145a8 |
# the working copy, but chages in the working copy do are
|
|
|
c145a8 |
# committed up to repository.
|
|
|
c145a8 |
cli_commitRepoChanges ${MANUAL_BASEDIR}
|
|
|
4c79b5 |
|
|
|
c145a8 |
done
|
|
|
4c79b5 |
}
|