Sfoglia il codice sorgente

Replace g.list/g.remove with g.mlist/g.mremove

git-svn-id: https://svn.osgeo.org/grass/grass/trunk@62011 15284696-431f-4ddb-bdfa-cd5b030d7da7
Huidae Cho 10 anni fa
parent
commit
b4de42710e

+ 1 - 1
general/g.list/Makefile

@@ -1,6 +1,6 @@
 MODULE_TOPDIR = ../..
 MODULE_TOPDIR = ../..
 
 
-PGM = g.mlist
+PGM = g.list
 
 
 LIBES = $(MANAGELIB) $(GISLIB) $(RASTERLIB) $(RASTER3DLIB) $(VECTORLIB)
 LIBES = $(MANAGELIB) $(GISLIB) $(RASTERLIB) $(RASTER3DLIB) $(VECTORLIB)
 DEPENDENCIES = $(MANAGEDEP) $(GISDEP) $(RASTERDEP) $(RASTER3DDEP) $(VECTORDEP)
 DEPENDENCIES = $(MANAGEDEP) $(GISDEP) $(RASTERDEP) $(RASTER3DDEP) $(VECTORDEP)

+ 25 - 31
general/g.list/g.mlist.html

@@ -1,16 +1,11 @@
 <h2>DESCRIPTION</h2>
 <h2>DESCRIPTION</h2>
 
 
-<em>g.mlist</em> searches for data files matching a pattern given by
-wildcards or POSIX Extended Regular Expressions. It is an extended
-version of <em><a href="g.list.html">g.list</a></em>.
-
-<p>
-See also the <em><a href="g.list.html">g.list</a></em> help page for
-discussion of some module options.
+<em>g.list</em> searches for data files matching a pattern given by
+wildcards or POSIX Extended Regular Expressions.
 
 
 <h2>NOTES</h2>
 <h2>NOTES</h2>
 
 
-The output of <em>g.mlist</em> may be useful for other programs' parameter
+The output of <em>g.list</em> may be useful for other programs' parameter
 input (e.g. time series for <em><a href="r.series.html">r.series</a></em>)
 input (e.g. time series for <em><a href="r.series.html">r.series</a></em>)
 when used with <em>separator=comma</em>.
 when used with <em>separator=comma</em>.
 
 
@@ -18,23 +13,23 @@ when used with <em>separator=comma</em>.
 
 
 List all available GRASS data base files:
 List all available GRASS data base files:
 <div class="code"><pre>
 <div class="code"><pre>
-g.mlist type=all
+g.list type=all
 </pre></div>
 </pre></div>
 
 
 List all raster and vector maps:
 List all raster and vector maps:
 <div class="code"><pre>
 <div class="code"><pre>
-g.mlist type=rast,vect
+g.list type=rast,vect
 </pre></div>
 </pre></div>
 
 
 <h3>Mapset search path</h3>
 <h3>Mapset search path</h3>
 
 
-If <b>mapset</b> is not specified than <em>g.mlist</em> searches for
+If <b>mapset</b> is not specified than <em>g.list</em> searches for
 data files in the mapsets which are included in the search path
 data files in the mapsets which are included in the search path
 (defined by <em><a href="g.mapsets.html">g.mapsets</a></em>),
 (defined by <em><a href="g.mapsets.html">g.mapsets</a></em>),
 see <tt>g.mapsets -p</tt>.
 see <tt>g.mapsets -p</tt>.
 
 
 <div class="code"><pre>
 <div class="code"><pre>
-g.mlist rast
+g.list rast
 
 
 raster map(s) available in mapset &lt;user1&gt;:
 raster map(s) available in mapset &lt;user1&gt;:
 dmt
 dmt
@@ -48,7 +43,7 @@ By option <b>mapset</b>=. (one dot) can be listed only data files from
 the current mapset:
 the current mapset:
 
 
 <div class="code"><pre>
 <div class="code"><pre>
-g.mlist rast mapset=.
+g.list rast mapset=.
 raster map(s) available in mapset &lt;user1&gt;:
 raster map(s) available in mapset &lt;user1&gt;:
 dmt
 dmt
 </pre></div>
 </pre></div>
@@ -58,7 +53,7 @@ available mapsets also including those which are not listed in the
 current search path (see <tt>g.mapsets -l</tt>).
 current search path (see <tt>g.mapsets -l</tt>).
 
 
 <div class="code"><pre>
 <div class="code"><pre>
-g.mlist rast mapset=*
+g.list rast mapset=*
 
 
 raster map(s) available in mapset &lt;landsat&gt;:
 raster map(s) available in mapset &lt;landsat&gt;:
 lsat5_1987_10
 lsat5_1987_10
@@ -75,41 +70,41 @@ aspect
 
 
 List all vector maps starting with letter "r":
 List all vector maps starting with letter "r":
 <div class="code"><pre>
 <div class="code"><pre>
-g.mlist type=vect pattern="r*"
+g.list type=vect pattern="r*"
 </pre></div>
 </pre></div>
 
 
 List all vector maps starting with letter "r" or "a":
 List all vector maps starting with letter "r" or "a":
 <div class="code"><pre>
 <div class="code"><pre>
-g.mlist type=vect pattern="[ra]*"
+g.list type=vect pattern="[ra]*"
 </pre></div>
 </pre></div>
 
 
 List all raster maps starting with "soil_" or "landuse_":
 List all raster maps starting with "soil_" or "landuse_":
 <div class="code"><pre>
 <div class="code"><pre>
-g.mlist type=rast pattern="{soil,landuse}_*"
+g.list type=rast pattern="{soil,landuse}_*"
 </pre></div>
 </pre></div>
 
 
 List certain raster maps with one variable character/number:
 List certain raster maps with one variable character/number:
 <div class="code"><pre>
 <div class="code"><pre>
-g.mlist type=rast pattern="N45E00?.meters"
+g.list type=rast pattern="N45E00?.meters"
 </pre></div>
 </pre></div>
 
 
 Use of <b>exclude</b> parameter:
 Use of <b>exclude</b> parameter:
 <div class="code"><pre>
 <div class="code"><pre>
 # without exclude:
 # without exclude:
-  g.mlist rast pat="r*" mapset=PERMANENT
+  g.list rast pat="r*" mapset=PERMANENT
   railroads
   railroads
   roads
   roads
   rstrct.areas
   rstrct.areas
   rushmore
   rushmore
 
 
 # exclude only complete word(s):
 # exclude only complete word(s):
-  g.mlist rast pat="r*" exclude=roads mapset=PERMANENT
+  g.list rast pat="r*" exclude=roads mapset=PERMANENT
   railroads
   railroads
   rstrct.areas
   rstrct.areas
   rushmore
   rushmore
 
 
 # exclude with wildcard:
 # exclude with wildcard:
-  g.mlist rast pat="r*" exclude="*roads*" mapset=PERMANENT
+  g.list rast pat="r*" exclude="*roads*" mapset=PERMANENT
   rstrct.areas
   rstrct.areas
   rushmore
   rushmore
 </pre></div>
 </pre></div>
@@ -118,31 +113,31 @@ Use of <b>exclude</b> parameter:
 
 
 List all soil maps starting with &quot;soils&quot; in their name:
 List all soil maps starting with &quot;soils&quot; in their name:
 <div class="code"><pre>
 <div class="code"><pre>
-g.mlist -r type=rast pattern='^soils'
+g.list -r type=rast pattern='^soils'
 </pre></div>
 </pre></div>
 
 
 List &quot;tmp&quot; if &quot;tmp&quot; raster map exists:
 List &quot;tmp&quot; if &quot;tmp&quot; raster map exists:
 <div class="code"><pre>
 <div class="code"><pre>
-g.mlist -r type=rast pattern='^tmp$'
+g.list -r type=rast pattern='^tmp$'
 </pre></div>
 </pre></div>
 
 
 List &quot;tmp0&quot; ...&quot;tmp9&quot; if corresponding vector map exists
 List &quot;tmp0&quot; ...&quot;tmp9&quot; if corresponding vector map exists
 (each map name linewise):
 (each map name linewise):
 <div class="code"><pre>
 <div class="code"><pre>
-g.mlist -r type=vect pattern='^tmp[0-9]$'
+g.list -r type=vect pattern='^tmp[0-9]$'
 </pre></div>
 </pre></div>
 
 
 List &quot;tmp0&quot;...&quot;tmp9&quot; if corresponding vector map exists
 List &quot;tmp0&quot;...&quot;tmp9&quot; if corresponding vector map exists
 (each map name comma separated):
 (each map name comma separated):
 <div class="code"><pre>
 <div class="code"><pre>
-g.mlist -r type=vect separator=comma pattern='^tmp[0-9]$'
+g.list -r type=vect separator=comma pattern='^tmp[0-9]$'
 </pre></div>
 </pre></div>
 
 
 <h3>Extended regular expressions</h3>
 <h3>Extended regular expressions</h3>
 
 
 List all precipitation maps for the years 1997-2012, comma separated:
 List all precipitation maps for the years 1997-2012, comma separated:
 <div class="code"><pre>
 <div class="code"><pre>
-g.mlist -e type=rast separator=comma pattern="precip_total.(199[7-9]|200[0-9]|201[0-2]).sum"
+g.list -e type=rast separator=comma pattern="precip_total.(199[7-9]|200[0-9]|201[0-2]).sum"
 </pre></div>
 </pre></div>
 
 
 <h3>Maps whose region overlaps with a saved region</h3>
 <h3>Maps whose region overlaps with a saved region</h3>
@@ -151,29 +146,28 @@ List all raster maps starting with &quot;tmp_&quot; whose region overlaps with
 the region of &quot;test&quot; raster map:
 the region of &quot;test&quot; raster map:
 <div class="code"><pre>
 <div class="code"><pre>
 g.region rast=test save=test_region
 g.region rast=test save=test_region
-g.mlist type=rast pattern='tmp_*' region=test_region
+g.list type=rast pattern='tmp_*' region=test_region
 </pre></div>
 </pre></div>
 
 
 List &quot;tmp0&quot;...&quot;tmp9&quot; vector maps whose region overlaps with
 List &quot;tmp0&quot;...&quot;tmp9&quot; vector maps whose region overlaps with
 the current region:
 the current region:
 <div class="code"><pre>
 <div class="code"><pre>
-g.mlist -r type=vect pattern='^tmp[0-9]$' region=.
+g.list -r type=vect pattern='^tmp[0-9]$' region=.
 </pre></div>
 </pre></div>
 
 
 List all raster and vector maps whose region overlaps with the default region
 List all raster and vector maps whose region overlaps with the default region
 of the PERMANENT mapset in the current location (DEFAULT_WIND):
 of the PERMANENT mapset in the current location (DEFAULT_WIND):
 <div class="code"><pre>
 <div class="code"><pre>
-g.mlist type=rast,vect region=*
+g.list type=rast,vect region=*
 </pre></div>
 </pre></div>
 
 
-Note that, without <tt>region=*</tt>, <tt>g.mlist type=rast,vect</tt> simply
+Note that, without <tt>region=*</tt>, <tt>g.list type=rast,vect</tt> simply
 lists all available raster and vector maps from the current search path
 lists all available raster and vector maps from the current search path
 regardless of their region.
 regardless of their region.
 
 
 <h2>SEE ALSO</h2>
 <h2>SEE ALSO</h2>
 
 
 <em>
 <em>
-<a href="g.list.html">g.list</a>,
 <a href="r.series.html">r.series</a>,
 <a href="r.series.html">r.series</a>,
 <a href="t.list.html">t.list</a>,
 <a href="t.list.html">t.list</a>,
 <a href="t.rast.list.html">t.rast.list</a>,
 <a href="t.rast.list.html">t.rast.list</a>,

+ 1 - 1
general/g.list/main.c

@@ -1,7 +1,7 @@
 
 
 /****************************************************************************
 /****************************************************************************
  *
  *
- * MODULE:       g.mlist
+ * MODULE:       g.list
  *
  *
  * AUTHOR(S):    Huidae Cho
  * AUTHOR(S):    Huidae Cho
  * 		 Based on general/manage/cmd/list.c by Michael Shapiro.
  * 		 Based on general/manage/cmd/list.c by Michael Shapiro.

+ 6 - 6
general/g.list/testsuite/test_g_mlist.py

@@ -1,11 +1,11 @@
-"""g.mlist tests"""
+"""g.list tests"""
 
 
 import grass.gunittest
 import grass.gunittest
 from grass.gunittest.gmodules import SimpleModule
 from grass.gunittest.gmodules import SimpleModule
 
 
 
 
 class GMlistWrongParamertersTest(grass.gunittest.TestCase):
 class GMlistWrongParamertersTest(grass.gunittest.TestCase):
-    """Test wrong input of parameters for g.mlist module"""
+    """Test wrong input of parameters for g.list module"""
 
 
     @classmethod
     @classmethod
     def setUpClass(cls):
     def setUpClass(cls):
@@ -20,7 +20,7 @@ class GMlistWrongParamertersTest(grass.gunittest.TestCase):
 
 
     def test_pt_flags(self):
     def test_pt_flags(self):
         """Test that -p and -t flags are exclusive"""
         """Test that -p and -t flags are exclusive"""
-        module = SimpleModule('g.mlist', flags='pt', type='rast')
+        module = SimpleModule('g.list', flags='pt', type='rast')
         self.assertModuleFail(module)
         self.assertModuleFail(module)
         stderr = module.outputs.stderr
         stderr = module.outputs.stderr
         self.assertIn('-p', stderr)
         self.assertIn('-p', stderr)
@@ -28,7 +28,7 @@ class GMlistWrongParamertersTest(grass.gunittest.TestCase):
 
 
     def test_ft_flags(self):
     def test_ft_flags(self):
         """Test that -f and -t flags are exclusive"""
         """Test that -f and -t flags are exclusive"""
-        module = SimpleModule('g.mlist', flags='ft', type='rast')
+        module = SimpleModule('g.list', flags='ft', type='rast')
         self.assertModuleFail(module)
         self.assertModuleFail(module)
         stderr = module.outputs.stderr
         stderr = module.outputs.stderr
         self.assertIn('-f', stderr)
         self.assertIn('-f', stderr)
@@ -36,7 +36,7 @@ class GMlistWrongParamertersTest(grass.gunittest.TestCase):
 
 
     def test_pf_flags(self):
     def test_pf_flags(self):
         """Test that -p and -f flags are exclusive"""
         """Test that -p and -f flags are exclusive"""
-        module = SimpleModule('g.mlist', flags='pf', type='rast')
+        module = SimpleModule('g.list', flags='pf', type='rast')
         self.assertModuleFail(module)
         self.assertModuleFail(module)
         stderr = module.outputs.stderr
         stderr = module.outputs.stderr
         self.assertIn('-p', stderr)
         self.assertIn('-p', stderr)
@@ -44,7 +44,7 @@ class GMlistWrongParamertersTest(grass.gunittest.TestCase):
 
 
     def test_re_flags(self):
     def test_re_flags(self):
         """Test that -r and -e flags are exclusive"""
         """Test that -r and -e flags are exclusive"""
-        module = SimpleModule('g.mlist', flags='re', type='rast')
+        module = SimpleModule('g.list', flags='re', type='rast')
         self.assertModuleFail(module)
         self.assertModuleFail(module)
         stderr = module.outputs.stderr
         stderr = module.outputs.stderr
         self.assertIn('-r', stderr)
         self.assertIn('-r', stderr)

+ 1 - 1
general/g.remove/Makefile

@@ -1,6 +1,6 @@
 MODULE_TOPDIR = ../..
 MODULE_TOPDIR = ../..
 
 
-PGM = g.mremove
+PGM = g.remove
 
 
 LIBES = $(MANAGELIB) $(RASTERLIB) $(GISLIB)
 LIBES = $(MANAGELIB) $(RASTERLIB) $(GISLIB)
 DEPENDENCIES = $(MANAGEDEP) $(RASTERDEP) $(GISDEP)
 DEPENDENCIES = $(MANAGEDEP) $(RASTERDEP) $(GISDEP)

+ 4 - 5
general/g.remove/g.mremove.html

@@ -1,6 +1,6 @@
 <h2>DESCRIPTION</h2>
 <h2>DESCRIPTION</h2>
 
 
-<em>g.mremove</em> removes data files matching a pattern given by wildcards or
+<em>g.remove</em> removes data files matching a pattern given by wildcards or
 POSIX Extended Regular Expressions. If the <b>-f</b> force flag is not given
 POSIX Extended Regular Expressions. If the <b>-f</b> force flag is not given
 then nothing is removed, instead the list of selected file names is printed to
 then nothing is removed, instead the list of selected file names is printed to
 <tt>stdout</tt> as a preview of the files to be deleted.
 <tt>stdout</tt> as a preview of the files to be deleted.
@@ -11,22 +11,21 @@ Delete all raster maps starting with "<tt>tmp_</tt>" in the current mapset:
 
 
 <div class="code"><pre>
 <div class="code"><pre>
 # show matching raster maps but do not delete yet (as verification)
 # show matching raster maps but do not delete yet (as verification)
-g.mremove type=rast pattern="tmp_*"
+g.remove type=rast pattern="tmp_*"
 
 
 # actually delete the matching raster maps
 # actually delete the matching raster maps
-g.mremove -f type=rast pattern="tmp_*"
+g.remove -f type=rast pattern="tmp_*"
 </pre></div>
 </pre></div>
 
 
 Delete all raster maps starting with "<tt>stream_</tt>" in the current mapset,
 Delete all raster maps starting with "<tt>stream_</tt>" in the current mapset,
 but exclude those ending with "<tt>_final</tt>":
 but exclude those ending with "<tt>_final</tt>":
 <div class="code"><pre>
 <div class="code"><pre>
-g.mremove -f type=rast pattern="stream_*" exclude="*_final"
+g.remove -f type=rast pattern="stream_*" exclude="*_final"
 </pre></div>
 </pre></div>
 
 
 <h2>SEE ALSO</h2>
 <h2>SEE ALSO</h2>
 
 
 <em>
 <em>
-<a href="g.remove.html">g.remove</a>
 </em>
 </em>
 
 
 <h2>AUTHOR</h2>
 <h2>AUTHOR</h2>

+ 2 - 3
general/g.remove/main.c

@@ -1,7 +1,7 @@
 
 
 /****************************************************************************
 /****************************************************************************
  *
  *
- * MODULE:       g.mremove
+ * MODULE:       g.remove
  *
  *
  * AUTHOR(S):    Huidae Cho <grass4u gmail.com>
  * AUTHOR(S):    Huidae Cho <grass4u gmail.com>
  *
  *
@@ -9,13 +9,12 @@
  *               CERL (original contributor),
  *               CERL (original contributor),
  *               Radim Blazek <radim.blazek gmail.com>,
  *               Radim Blazek <radim.blazek gmail.com>,
  *               Cedric Shock <cedricgrass shockfamily.net>,
  *               Cedric Shock <cedricgrass shockfamily.net>,
- *               Huidae Cho <grass4u gmail.com>,
  *               Glynn Clements <glynn gclements.plus.com>,
  *               Glynn Clements <glynn gclements.plus.com>,
  *               Jachym Cepicky <jachym les-ejk.cz>,
  *               Jachym Cepicky <jachym les-ejk.cz>,
  *               Markus Neteler <neteler itc.it>,
  *               Markus Neteler <neteler itc.it>,
  *               Martin Landa <landa.martin gmail.com>
  *               Martin Landa <landa.martin gmail.com>
  *
  *
- * PURPOSE:      lets users remove GRASS database files
+ * PURPOSE:      Lets users remove GRASS database files
  *
  *
  * COPYRIGHT:    (C) 1999-2014 by the GRASS Development Team
  * COPYRIGHT:    (C) 1999-2014 by the GRASS Development Team
  *
  *

+ 8 - 8
general/g.remove/testsuite/test_g_mremove.py

@@ -1,4 +1,4 @@
-"""Test of g.mremove module"""
+"""Test of g.remove module"""
 
 
 # TODO: rmapcalc probably fatals, replace or add raise on error?
 # TODO: rmapcalc probably fatals, replace or add raise on error?
 from grass.script.raster import mapcalc as rmapcalc
 from grass.script.raster import mapcalc as rmapcalc
@@ -36,7 +36,7 @@ Removing raster <test_two>
 
 
 
 
 class GMRemoveTest(grass.gunittest.TestCase):
 class GMRemoveTest(grass.gunittest.TestCase):
-    """Test removing with g.mremove"""
+    """Test removing with g.remove"""
 
 
     @classmethod
     @classmethod
     def setUpClass(cls):
     def setUpClass(cls):
@@ -55,14 +55,14 @@ class GMRemoveTest(grass.gunittest.TestCase):
             rmapcalc("test_map_%i = 100" % i)
             rmapcalc("test_map_%i = 100" % i)
         rmapcalc("test_two = 2")
         rmapcalc("test_two = 2")
 
 
-        module = SimpleModule('g.mremove',
+        module = SimpleModule('g.remove',
                               type='rast', pattern='test_map_*,*two')
                               type='rast', pattern='test_map_*,*two')
         self.assertModule(module)
         self.assertModule(module)
         self.assertMultiLineEqual(module.outputs.stdout,
         self.assertMultiLineEqual(module.outputs.stdout,
                                   REMOVE_RASTERS.replace('user1',
                                   REMOVE_RASTERS.replace('user1',
                                                          get_current_mapset()))
                                                          get_current_mapset()))
 
 
-        module = SimpleModule('g.mremove', type='rast',
+        module = SimpleModule('g.remove', type='rast',
                               pattern='test_map_*,*two', flags='f')
                               pattern='test_map_*,*two', flags='f')
         self.assertModule(module)
         self.assertModule(module)
         self.assertMultiLineEqual(module.outputs.stdout, '')
         self.assertMultiLineEqual(module.outputs.stdout, '')
@@ -74,7 +74,7 @@ class GMRemoveTest(grass.gunittest.TestCase):
         rmapcalc("test_oranges = 200")
         rmapcalc("test_oranges = 200")
         rmapcalc("test_apples_big = 300")
         rmapcalc("test_apples_big = 300")
         rmapcalc("test_apples_small = 300")
         rmapcalc("test_apples_small = 300")
-        module = SimpleModule('g.mremove', type='rast',
+        module = SimpleModule('g.remove', type='rast',
                               pattern='test_{apples,oranges}*',
                               pattern='test_{apples,oranges}*',
                               exclude="*_small")
                               exclude="*_small")
         self.assertModule(module)
         self.assertModule(module)
@@ -83,7 +83,7 @@ class GMRemoveTest(grass.gunittest.TestCase):
                                   'rast/test_apples_big@user1\n'
                                   'rast/test_apples_big@user1\n'
                                   'rast/test_oranges@user1\n'.replace(
                                   'rast/test_oranges@user1\n'.replace(
                                       'user1', get_current_mapset()))
                                       'user1', get_current_mapset()))
-        module = SimpleModule('g.mremove', type='rast',
+        module = SimpleModule('g.remove', type='rast',
                               pattern='test_{apples,oranges}{_small,_big,*}',
                               pattern='test_{apples,oranges}{_small,_big,*}',
                               flags='f')
                               flags='f')
         self.assertModule(module)
         self.assertModule(module)
@@ -93,11 +93,11 @@ class GMRemoveTest(grass.gunittest.TestCase):
 
 
 
 
 class GMRemoveWrongInputTest(grass.gunittest.TestCase):
 class GMRemoveWrongInputTest(grass.gunittest.TestCase):
-    """Test wrong input of parameters for g.mlist module"""
+    """Test wrong input of parameters for g.remove module"""
 
 
     def test_re_flags(self):
     def test_re_flags(self):
         """Test that -r and -e flags are exclusive"""
         """Test that -r and -e flags are exclusive"""
-        module = SimpleModule('g.mremove', flags='re',
+        module = SimpleModule('g.remove', flags='re',
                               type='rast', pattern='xxxyyyzzz')
                               type='rast', pattern='xxxyyyzzz')
         self.assertModuleFail(module)
         self.assertModuleFail(module)
         stderr = module.outputs.stderr
         stderr = module.outputs.stderr