[GRASS-SVN] r50226 - grass/branches/develbranch_6/scripts/g.manual
svn_grass at osgeo.org
svn_grass at osgeo.org
Tue Jan 17 01:15:48 EST 2012
Author: hamish
Date: 2012-01-16 22:15:48 -0800 (Mon, 16 Jan 2012)
New Revision: 50226
Modified:
grass/branches/develbranch_6/scripts/g.manual/g.manual
Log:
also look in the addon path(s) for the help page
Modified: grass/branches/develbranch_6/scripts/g.manual/g.manual
===================================================================
--- grass/branches/develbranch_6/scripts/g.manual/g.manual 2012-01-17 05:39:16 UTC (rev 50225)
+++ grass/branches/develbranch_6/scripts/g.manual/g.manual 2012-01-17 06:15:48 UTC (rev 50226)
@@ -69,30 +69,59 @@
start_browser()
{
- if test ! -f "$GRASS_DOC_BASE"/docs/html/$1.html -a -n $1 ; then
- g.message -e "No HTML manual page entry for <$1>."
- exit 1
- else
- if [ -z "$GRASS_VERBOSE" ] || [ "$GRASS_VERBOSE" -gt 1 ] ; then
- g.message "Starting browser <$BROWSERNAME> for module $1..."
+ DOC_BASE="$GRASS_DOC_BASE/docs/html"
+ if test ! -f "$DOC_BASE/$1.html" -a -n "$1" ; then
+ DOC_BASE=""
+ IFS=":"
+ for ADDON_PATH in "$GRASS_ADDON_PATH" ; do
+ if [ -f "$ADDON_PATH/docs/html/$1.html" ] ; then
+ DOC_BASE="$ADDON_PATH/docs/html"
+ break
+ fi
+ done
+ unset IFS
+ if [ -z "$DOC_BASE" ] ; then
+ g.message -e "No HTML manual page entry for <$1>."
+ exit 1
fi
- "$GRASS_HTML_BROWSER" file://"$GRASS_DOC_BASE"/docs/html/$1.html
fi
+ if [ -z "$GRASS_VERBOSE" ] || [ "$GRASS_VERBOSE" -gt 1 ] ; then
+ g.message "Starting browser <$BROWSERNAME> for module $1..."
+ fi
+ "$GRASS_HTML_BROWSER" file://"$DOC_BASE/$1.html"
}
start_man()
{
- if test ! -f "$GRASS_DOC_BASE"/man/man1/$1.1 -a -n $1 ; then
- if test ! -f "$GRASS_DOC_BASE"/man/man1/$1.1.gz -a -n $1 ; then
- echo "ERROR: no MAN page entry for <$1>." 1>&2
+ DOC_BASE="$GRASS_DOC_BASE/man/man1"
+ if [ -z "$1" ] ; then
+ g.message -e "Programmer error"
+ exit 1
+ fi
+
+ if [ ! -f "$DOC_BASE/$1.1" ] && [ ! -f "$DOC_BASE/$1.1.gz" ] ; then
+ DOC_BASE=""
+ IFS=":"
+ for ADDON_PATH in "$GRASS_ADDON_PATH" ; do
+ if [ -f "$ADDON_PATH/docs/man/man1/$1.1" ] || \
+ [ -f "$ADDON_PATH/docs/man/man1/$1.1.gz" ] ; then
+ DOC_BASE="$ADDON_PATH/docs/man/man1"
+ break
+ fi
+ done
+ unset IFS
+ if [ -z "$DOC_BASE" ] ; then
+ g.message -e "No man page entry for <$1>."
exit 1
- else
- man "$GRASS_DOC_BASE"/man/man1/$1.1.gz
fi
- g.message -e "No MAN page entry for <$1>."
- exit 1
+ fi
+
+ if [ -f "$DOC_BASE/$1.1" ] ; then
+ man "$DOC_BASE/$1.1"
+ elif [ -f "$DOC_BASE/$1.1.gz" ] ; then
+ man "$DOC_BASE/$1.1.gz"
else
- man "$GRASS_DOC_BASE"/man/man1/$1.1
+ g.message -e "No man page entry for <$1>."
fi
}
More information about the grass-commit
mailing list