Blame Scripts/Functions/Help/help.sh

4c79b5
#!/bin/bash
4c79b5
#
02d6e2
# help.sh -- This function standardizes the way documentation is
06d8c8
# produced and maintained inside the working copy of CentOS Artwork
02d6e2
# Repository.
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
dcd347
# the Free Software Foundation; either version 2 of the License, or (at
dcd347
# 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
c145a8
    local ACTIONNAM=''
c145a8
    local ACTIONVAL=''
c145a8
1b527b
    # Initialize the search option. The search option (`--search')
1b527b
    # specifies the pattern used inside info files when an index
1b527b
    # search is perform.
1b527b
    FLAG_SEARCH=""
1b527b
fa1906
    # Initialize the backend option. The backend option (`--backend')
fa1906
    # specifies the backend used to manipulate the repository
deaa54
    # documentation manual.
9de1b5
    FLAG_BACKEND="texinfo"
5285d6
0c5b48
    # Define manual base directory. This is the place where all
0c5b48
    # different formats of repository documentation manual are stored
0c5b48
    # in.
0c5b48
    MANUAL_BASEDIR="$(cli_getRepoTLDir)/Manuals"
e5750b
3ae895
    # Define file name (without extension) for documentation manual.
420e77
    MANUAL_NAME=$(cli_getRepoName "repository" -f)
1f6dd8
0c5b48
    # Define language information used by manual.
0c5b48
    MANUAL_LANG=$(cli_getCurrentLocale)
420e77
0c5b48
    # Interpret option arguments passed through the command-line.
0c5b48
    ${FUNCNAM}_getOptions
116f45
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"
0c5b48
e5750b
    # Verify and initialize backend functions.  There is no need to
e5750b
    # load all backend-specific functions when we can use just one
e5750b
    # backend among many. Keep the cli_getFunctions function calling
e5750b
    # after all variables and arguments definitions.
e5750b
    if [[ ${FLAG_BACKEND} =~ '^texinfo$' ]];then
e5750b
        cli_getFunctions "${FUNCDIR}/${FUNCDIRNAM}" 'texinfo'
e5750b
    elif [[ ${FLAG_BACKEND} =~ '^docbook$' ]];then
e5750b
        cli_getFunctions "${FUNCDIR}/${FUNCDIRNAM}" 'docbook'
e5750b
    else
e5750b
        cli_printMessage "`gettext "The backend provided is not supported."`" --as-error-line
e5750b
    fi
c145a8
0c5b48
    # Execute backend initialization.
0c5b48
    ${FLAG_BACKEND} "$@"
b45dde
4c79b5
}