|
|
4c79b5 |
#!/bin/bash
|
|
|
4c79b5 |
#
|
|
|
027c27 |
# help_getEntry.sh -- This function builds a documentation entry based
|
|
|
638bf8 |
# on a location specified. Location specification can be both action
|
|
|
638bf8 |
# value (ACTIONVAL) variable or a value passed as first positional
|
|
|
638bf8 |
# parameter.
|
|
|
4c79b5 |
#
|
|
|
2d3646 |
# Copyright (C) 2009, 2010, 2011 The CentOS Project
|
|
|
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 |
|
|
|
027c27 |
function help_getEntry {
|
|
|
4c79b5 |
|
|
|
4c79b5 |
# Define variables as local to avoid conflicts outside.
|
|
|
4c79b5 |
local ENTRY=''
|
|
|
638bf8 |
local LOCATION=''
|
|
|
638bf8 |
|
|
|
638bf8 |
# Redefine location in order to make this function reusable not
|
|
|
638bf8 |
# just for action value variable but whatever value passed as
|
|
|
638bf8 |
# first possitional argument.
|
|
|
638bf8 |
if [[ "$1" != '' ]];then
|
|
|
638bf8 |
LOCATION="$1"
|
|
|
638bf8 |
else
|
|
|
638bf8 |
LOCATION="$ACTIONVAL"
|
|
|
638bf8 |
fi
|
|
|
4c79b5 |
|
|
|
5285d6 |
# Define relative path of entry, from trunk directory on.
|
|
|
5285d6 |
ENTRY=$(echo $LOCATION | sed -r "s!^${HOME}/artwork/!!")
|
|
|
4c79b5 |
|
|
|
5285d6 |
# Verify the entry relative path to find out which documentation
|
|
|
5285d6 |
# manual we are acting on. As convenction, whatever documentation
|
|
|
6650f1 |
# entry you provide outside trunk/Manuals/ directory structure is
|
|
|
6650f1 |
# considered as you are documenting the repository directory
|
|
|
6650f1 |
# structure. Otherwise, if an entry inside trunk/Manuals/ is
|
|
|
6650f1 |
# provided, the directory structure provided is used as default
|
|
|
6650f1 |
# documentation manual for actions like `--create' and `--update'
|
|
|
6650f1 |
# to take place on. Other options like `--edit', `--delete' and
|
|
|
6650f1 |
# `--read' cannot be applied to paths provided inside
|
|
|
6650f1 |
# trunk/Manuals/ such actions need to be performed manually.
|
|
|
966109 |
if [[ ${ENTRY} =~ '\.texi$' ]];then
|
|
|
6650f1 |
ENTRY=$(echo ${ENTRY} | sed 's!trunk/Manuals/!!')
|
|
|
5285d6 |
else
|
|
|
027c27 |
ENTRY=$(dirname Directories/${ENTRY})/$(basename $LOCATION).${FLAG_BACKEND}
|
|
|
5285d6 |
fi
|
|
|
4c79b5 |
|
|
|
5285d6 |
# Re-define entry to set absolute path to manuals base directory
|
|
|
5285d6 |
# structure.
|
|
|
5285d6 |
ENTRY=${MANUAL_BASEDIR}/${ENTRY}
|
|
|
4c79b5 |
|
|
|
4c79b5 |
# Output entry's absolute path.
|
|
|
5285d6 |
echo ${ENTRY}
|
|
|
4c79b5 |
|
|
|
4c79b5 |
}
|