[GRASS-SVN] r65294 - grass/trunk/lib/init

svn_grass at osgeo.org svn_grass at osgeo.org
Wed May 20 10:50:26 PDT 2015


Author: wenzeslaus
Date: 2015-05-20 10:50:26 -0700 (Wed, 20 May 2015)
New Revision: 65294

Modified:
   grass/trunk/lib/init/grass.py
   grass/trunk/lib/init/grass7.html
Log:
init: use standard long flag syntax for 'exec', improve its help

Modified: grass/trunk/lib/init/grass.py
===================================================================
--- grass/trunk/lib/init/grass.py	2015-05-20 13:19:26 UTC (rev 65293)
+++ grass/trunk/lib/init/grass.py	2015-05-20 17:50:26 UTC (rev 65294)
@@ -236,7 +236,7 @@
           [-c | -c geofile | -c EPSG:code[:datum_trans]]
           [-e] [-f] [-text | -gtext | -gui] [--config param]
           [[[GISDBASE/]LOCATION_NAME/]MAPSET]
-  $CMD_NAME [FLAG]... GISDBASE/LOCATION_NAME/MAPSET exec MODULE [PARAM]...
+  $CMD_NAME [FLAG]... GISDBASE/LOCATION_NAME/MAPSET --exec EXECUTABLE [EPARAM]...
 
 {flags}:
   -h or -help or --help or --h   {help_flag}
@@ -252,7 +252,7 @@
                                    {gui_detail}
   --config                       {config}
                                    {config_detail}
-  exec MODULE                    {exec_}
+  --exec EXECUTABLE              {exec_}
                                    {exec_detail}
 
 {params}:
@@ -264,6 +264,10 @@
 
   GISDBASE/LOCATION_NAME/MAPSET  {full_mapset}
 
+  EXECUTABLE                     {executable}
+  EPARAM                         {executable_params}
+  FLAG                           {standard_flags}
+
 {env_vars}:
   GRASS_GUI                      {gui_var}
   GRASS_HTML_BROWSER             {html_var}
@@ -302,7 +306,10 @@
     batch_var=_("shell script to be processed as batch job"),
     python_var=_("set python shell name to override 'python'"),
     exec_=_("execute GRASS module or script"),
-    exec_detail=_("any executable will be executed in GRASS session"),
+    exec_detail=_("provided executable will be executed in GRASS session"),
+    executable=_("GRASS module, script or any other executable"),
+    executable_params=_("parameters of the executable"),
+    standard_flags=_("standard flags"),
     )
 
 
@@ -1663,10 +1670,10 @@
     batch_job = get_batch_job_from_env_variable()
 
     # Parse the command-line options and set several global variables
-    batch_exec_subcommand = 'exec'
+    batch_exec_param = '--exec'
     try:
         # raises ValueError when not found
-        index = sys.argv.index(batch_exec_subcommand)
+        index = sys.argv.index(batch_exec_param)
         batch_job = sys.argv[index + 1:]
         clean_argv = sys.argv[1:index]
         params = parse_cmdline(clean_argv, default_gui=default_gui)

Modified: grass/trunk/lib/init/grass7.html
===================================================================
--- grass/trunk/lib/init/grass7.html	2015-05-20 13:19:26 UTC (rev 65293)
+++ grass/trunk/lib/init/grass7.html	2015-05-20 17:50:26 UTC (rev 65294)
@@ -271,20 +271,20 @@
 Link external raster data to PERMANENT Mapset:
 
 <div class="code"><pre>
-grass71 .../grassdata/test1/PERMANENT/ exec r.external input=basins.tiff output=basins
-grass71 .../grassdata/test1/PERMANENT/ exec r.external input=elevation.tiff output=elevation
+grass71 .../grassdata/test1/PERMANENT/ --exec r.external input=basins.tiff output=basins
+grass71 .../grassdata/test1/PERMANENT/ --exec r.external input=elevation.tiff output=elevation
 </pre></div>
 
 Get statistics for one raster map:
 
 <div class="code"><pre>
-grass71 .../grassdata/test1/PERMANENT/ exec r.univar map=elevation
+grass71 .../grassdata/test1/PERMANENT/ --exec r.univar map=elevation
 </pre></div>
 
 Compare the rasters visually:
 
 <div class="code"><pre>
-grass71 .../grassdata/test1/PERMANENT/ exec g.gui.mapswipe first=elevation second=basins
+grass71 .../grassdata/test1/PERMANENT/ --exec g.gui.mapswipe first=elevation second=basins
 </pre></div>
 
 



More information about the grass-commit mailing list