|
Alain Reguera Delgado |
ddf7d2 |
#!/bin/bash
|
|
Alain Reguera Delgado |
ddf7d2 |
######################################################################
|
|
Alain Reguera Delgado |
ddf7d2 |
#
|
|
Alain Reguera Delgado |
eb3010 |
# tcar_printHelp.sh -- This function standardizes the way
|
|
Alain Reguera Delgado |
ddf7d2 |
# centos-art.sh script prints help about itself.
|
|
Alain Reguera Delgado |
ddf7d2 |
#
|
|
Alain Reguera Delgado |
0e5ba0 |
# Written by:
|
|
Alain Reguera Delgado |
ddf7d2 |
# * Alain Reguera Delgado <al@centos.org.cu>, 2009-2013
|
|
Alain Reguera Delgado |
ddf7d2 |
#
|
|
Alain Reguera Delgado |
0e5ba0 |
# Copyright (C) 2009-2013 The CentOS Artwork SIG
|
|
Alain Reguera Delgado |
ddf7d2 |
#
|
|
Alain Reguera Delgado |
ddf7d2 |
# This program is free software; you can redistribute it and/or modify
|
|
Alain Reguera Delgado |
ddf7d2 |
# it under the terms of the GNU General Public License as published by
|
|
Alain Reguera Delgado |
ddf7d2 |
# the Free Software Foundation; either version 2 of the License, or (at
|
|
Alain Reguera Delgado |
ddf7d2 |
# your option) any later version.
|
|
Alain Reguera Delgado |
ddf7d2 |
#
|
|
Alain Reguera Delgado |
ddf7d2 |
# This program is distributed in the hope that it will be useful, but
|
|
Alain Reguera Delgado |
ddf7d2 |
# WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
Alain Reguera Delgado |
ddf7d2 |
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
|
Alain Reguera Delgado |
ddf7d2 |
# General Public License for more details.
|
|
Alain Reguera Delgado |
ddf7d2 |
#
|
|
Alain Reguera Delgado |
ddf7d2 |
# You should have received a copy of the GNU General Public License
|
|
Alain Reguera Delgado |
ddf7d2 |
# along with this program; if not, write to the Free Software
|
|
Alain Reguera Delgado |
ddf7d2 |
# Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
|
|
Alain Reguera Delgado |
ddf7d2 |
#
|
|
Alain Reguera Delgado |
ddf7d2 |
######################################################################
|
|
Alain Reguera Delgado |
ddf7d2 |
|
|
Alain Reguera Delgado |
eb3010 |
function tcar_printHelp {
|
|
Alain Reguera Delgado |
ddf7d2 |
|
|
Alain Reguera Delgado |
90b3f7 |
# Retrieve the man page name. This is the file name you want to retrieve
|
|
Alain Reguera Delgado |
90b3f7 |
# documentation for. This value is optional. When it is not passed, the
|
|
Alain Reguera Delgado |
90b3f7 |
# module name is used.
|
|
Alain Reguera Delgado |
90b3f7 |
local TCAR_MANPAGE_NAME="${1:-${TCAR_MODULE_NAME}}"
|
|
Alain Reguera Delgado |
65f472 |
|
|
Alain Reguera Delgado |
daf41a |
# When the module name has not been set and the tcar_printHelp
|
|
Alain Reguera Delgado |
daf41a |
# function is called from centos-art.sh file, the page name come
|
|
Alain Reguera Delgado |
daf41a |
# with with --help as opening string and probably as
|
|
Alain Reguera Delgado |
daf41a |
# --help=filename.sh. In the first case it prints the script
|
|
Alain Reguera Delgado |
daf41a |
# documentation. In the second case it prints documentation for
|
|
Alain Reguera Delgado |
daf41a |
# the file specified.
|
|
Alain Reguera Delgado |
daf41a |
if [[ -z ${TCAR_MODULE_NAME} ]];then
|
|
Alain Reguera Delgado |
daf41a |
if [[ ${TCAR_MANPAGE_NAME} =~ '^--help=[[:alnum:]_-.]+' ]];then
|
|
Alain Reguera Delgado |
daf41a |
TCAR_MANPAGE_NAME=$(echo ${TCAR_MANPAGE_NAME} | cut -d'=' -f2)
|
|
Alain Reguera Delgado |
daf41a |
else
|
|
Alain Reguera Delgado |
daf41a |
TCAR_MANPAGE_NAME=${TCAR_SCRIPT_NAME}
|
|
Alain Reguera Delgado |
daf41a |
fi
|
|
Alain Reguera Delgado |
90b3f7 |
fi
|
|
Alain Reguera Delgado |
90b3f7 |
|
|
Alain Reguera Delgado |
90b3f7 |
# Print requested documentation.
|
|
Alain Reguera Delgado |
0900a1 |
/usr/bin/man -M ${TCAR_SCRIPT_DIR_MANUALS}:${TCAR_MODULE_DIR_MANUALS}/Final "${TCAR_MANPAGE_NAME}"
|
|
Alain Reguera Delgado |
06ab0f |
|
|
Alain Reguera Delgado |
06ab0f |
# Finish script execution successfully.
|
|
Alain Reguera Delgado |
ddf7d2 |
exit 0
|
|
Alain Reguera Delgado |
ddf7d2 |
|
|
Alain Reguera Delgado |
ddf7d2 |
}
|