[GRASS-SVN] r54811 - grass/branches/releasebranch_6_4/scripts/g.manual

svn_grass at osgeo.org svn_grass at osgeo.org
Mon Jan 28 03:25:45 PST 2013


Author: hamish
Date: 2013-01-28 03:25:44 -0800 (Mon, 28 Jan 2013)
New Revision: 54811

Modified:
   grass/branches/releasebranch_6_4/scripts/g.manual/g.manual
Log:
also look for help/man page in the addons dir (merge from devbr6)

Modified: grass/branches/releasebranch_6_4/scripts/g.manual/g.manual
===================================================================
--- grass/branches/releasebranch_6_4/scripts/g.manual/g.manual	2013-01-28 11:12:56 UTC (rev 54810)
+++ grass/branches/releasebranch_6_4/scripts/g.manual/g.manual	2013-01-28 11:25:44 UTC (rev 54811)
@@ -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