Blame Scripts/Functions/Help/help.sh

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
c145a8
    local ACTIONNAM=''
c145a8
    local ACTIONVAL=''
c145a8
771ff2
    # Initialize search option (`--search'). This option is used to
771ff2
    # look for documentation inside documentation backends.
1b527b
    FLAG_SEARCH=""
1b527b
09b4e0
    # Define manual top level directory. This is where
522184
    # backend-specific documentation structures are stored in.
b411ec
    MANUAL_TLDIR="$(cli_getRepoTLDir)/Manuals/TCAR-UG"
09b4e0
771ff2
    # Define manual language.
771ff2
    MANUAL_LANG=$(cli_getCurrentLocale)
771ff2
771ff2
    # Define default documentation backend.
522184
    MANUAL_BACKEND='texinfo'
23c4a7
771ff2
    # Define backend directory path. This is the place where common
771ff2
    # files to all languages and language-specific directories are
771ff2
    # stored in.
771ff2
    MANUAL_BACKEND_DIR=${MANUAL_TLDIR}/$(cli_getRepoName $MANUAL_BACKEND -d)
771ff2
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. 
522184
    eval set -- "$ARGUMENTS" 
23c4a7
522184
    # Initialize backend-specific functionalities.
522184
    cli_exportFunctions "${FUNCDIR}/${FUNCDIRNAM}/$(cli_getRepoName \
522184
        ${MANUAL_BACKEND} -d)" "${MANUAL_BACKEND}"
23c4a7
522184
    # Execute backend-specific actions.
771ff2
    ${MANUAL_BACKEND} $@
c145a8
522184
    # Unset backend-specific functionalities.
522184
    cli_unsetFunctions "${FUNCDIR}/${FUNCDIRNAM}/$(cli_getRepoName \
522184
        ${MANUAL_BACKEND} -d)" "${MANUAL_BACKEND}"
23c4a7
23c4a7
}