[GRASS-SVN] r54551 - grass/trunk/scripts/g.manual

svn_grass at osgeo.org svn_grass at osgeo.org
Sun Jan 6 07:32:45 PST 2013


Author: martinl
Date: 2013-01-06 07:32:45 -0800 (Sun, 06 Jan 2013)
New Revision: 54551

Modified:
   grass/trunk/scripts/g.manual/g.manual.html
   grass/trunk/scripts/g.manual/g.manual.py
Log:
g.manual: add flag to display topics


Modified: grass/trunk/scripts/g.manual/g.manual.html
===================================================================
--- grass/trunk/scripts/g.manual/g.manual.html	2013-01-06 15:18:22 UTC (rev 54550)
+++ grass/trunk/scripts/g.manual/g.manual.html	2013-01-06 15:32:45 UTC (rev 54551)
@@ -5,21 +5,27 @@
 
 <h2>NOTES</h2>
 
-The name of the HTML browser is defined in the environment variable
+The name of the browser is defined in the environment variable
 <tt>GRASS_HTML_BROWSER</tt>. For most platforms this should be an
 executable in your PATH, or the full path to an executable. See
 <a href="variables.html">variables</a> for details.
 
 <h2>EXAMPLES</h2>
 
+Show index page in the browser.
+
 <div class="code"><pre>
-# how index
-g.manual index
+g.manual -i
+</pre></div>
 
-# show module manual page in HTML browser
+Show manual page of <em><a href="d.vect.html">d.vect</a></em> module
+in the browser.
+<div class="code"><pre>
 g.manual d.vect
+</pre></div>
 
-# show module manual page in terminal
+Show module manual page in terminal.
+<div class="code"><pre>
 g.manual -m d.vect
 </pre></div>
 
@@ -27,4 +33,5 @@
 
 Markus Neteler
 
-<p><i>Last changed: $Date$</i>
+<p>
+<i>Last changed: $Date$</i>

Modified: grass/trunk/scripts/g.manual/g.manual.py
===================================================================
--- grass/trunk/scripts/g.manual/g.manual.py	2013-01-06 15:18:22 UTC (rev 54550)
+++ grass/trunk/scripts/g.manual/g.manual.py	2013-01-06 15:32:45 UTC (rev 54551)
@@ -6,7 +6,7 @@
 # AUTHOR(S):	Markus Neteler
 #               Converted to Python by Glynn Clements
 # PURPOSE:	Display the HTML/MAN pages
-# COPYRIGHT:	(C) 2003, 2008, 2010 by the GRASS Development Team
+# COPYRIGHT:	(C) 2003, 2008, 2010-2012 by the GRASS Development Team
 #
 #		This program is free software under the GNU General Public
 #		License (>=v2). Read the file COPYING that comes with GRASS
@@ -15,7 +15,7 @@
 #############################################################################
 
 #%module
-#% description: Display the HTML manual pages of GRASS modules
+#% description: Displays the manual pages of GRASS modules.
 #% keywords: general
 #% keywords: manual
 #% keywords: help
@@ -26,6 +26,11 @@
 #% suppress_required: yes
 #%end
 #%flag
+#% key: t
+#% description: Display topics
+#% suppress_required: yes
+#%end
+#%flag
 #% key: m
 #% description: Display as MAN text page instead of HTML page in browser
 #%end
@@ -70,13 +75,25 @@
 def main():
     global gisbase, browser, browser_name
     
-    index  = flags['i']
-    manual = flags['m']
+    if flags['i'] and flags['t']:
+        grass.fatal(_("Flags -%c and -%c are mutually exclusive") % ('i', 't'))
+    
+    special = None
+    if flags['i']:
+        special = 'index'
+    elif flags ['t']:
+        special = 'topics'
+    
+    if flags['m']:
+        start = start_man
+    else:
+        start = start_browser
+    
     entry  = options['entry']
     
     gisbase = os.environ['GISBASE']
     
-    browser = os.getenv('GRASS_HTML_BROWSER')
+    browser = os.getenv('GRASS_HTML_BROWSER', '')
     
     if sys.platform == 'darwin':
         # hack for MacOSX
@@ -89,17 +106,11 @@
     
     # keep order!
     # first test for index...
-    if index:
-	if manual:
-	    start_man('index')
-	else:
-	    start_browser('index')
-        return 0
+    if special:
+        start(special)
+    else:
+        start(entry)
     
-    if manual:
-	start_man(entry)
-    else:
-	start_browser(entry)
     return 0
 
 if __name__ == "__main__":



More information about the grass-commit mailing list