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.
6150a1
    local FLAG_SEARCH=""
1b527b
6150a1
    # Initialize manual's ID. By default, The CentOS Artwork
6150a1
    # Repository User's Guide is used. This value can be changed
6150a1
    # using the `--manual' option from the command-line.
6150a1
    local FLAG_MANUAL="TCAR-UG"
09b4e0
6150a1
    # Initialize manual's language.
6150a1
    local MANUAL_L10N=$(cli_getCurrentLocale)
771ff2
6150a1
    # Initialize manual's backend. By default, texinfo is used as
6150a1
    # documentation backend. This value can be changed using the
6150a1
    # `--backend' option from the command-line.
6150a1
    local MANUAL_BACKEND='texinfo'
771ff2
0c5b48
    # Interpret option arguments passed through the command-line.
0c5b48
    ${FUNCNAM}_getOptions
116f45
6150a1
    # Initialize manual's backend directory. This is the place where
6150a1
    # the backend specific documentation structure is stored in.
6150a1
    MANUAL_TLDIR="${HOME}/artwork/branches/Manuals/$(cli_getRepoName \
6150a1
        $MANUAL_BACKEND -d)/${FLAG_MANUAL}"
6150a1
6150a1
    # Initialize manual's file name (without extension).
6150a1
    MANUAL_NAME=$(cli_getRepoName "$(basename $FLAG_MANUAL)" -f)
6150a1
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
23c4a7
}