[GRASS-SVN] r61827 - sandbox/martinl

svn_grass at osgeo.org svn_grass at osgeo.org
Sun Sep 7 06:42:23 PDT 2014


Author: neteler
Date: 2014-09-07 06:42:23 -0700 (Sun, 07 Sep 2014)
New Revision: 61827

Added:
   sandbox/martinl/print_module_parameters_csv.py
Log:
add simple script to print modules option keys and descriptions as CSV table

Added: sandbox/martinl/print_module_parameters_csv.py
===================================================================
--- sandbox/martinl/print_module_parameters_csv.py	                        (rev 0)
+++ sandbox/martinl/print_module_parameters_csv.py	2014-09-07 13:42:23 UTC (rev 61827)
@@ -0,0 +1,23 @@
+#!/usr/bin/python
+# -*- coding: utf-8 -*-
+
+# prints for each GRASS module list of option keys and descriptions
+
+from grass.script import task as gtask
+from grass.script.core import get_commands
+
+def main():
+#    print '-' * 80
+    for cmd in sorted(get_commands()[0]):
+        task = gtask.grassTask(cmd)
+        if task.get_name() == 'g.parser': # special case
+            print task.get_name()
+        for f in task.get_options()['flags']:
+            if len(f.get('name')) > 1: # skip --overwrite, ...
+                continue
+            print task.get_name() + '€' + f.get('name') + '€' + f.get('description')
+        for p in task.get_options()['params']:
+            print task.get_name() + '€' + p.get('name') + '€' + p.get('description')
+
+if __name__ == "__main__":
+    main()


Property changes on: sandbox/martinl/print_module_parameters_csv.py
___________________________________________________________________
Added: svn:mime-type
   + text/x-python
Added: svn:eol-style
   + native



More information about the grass-commit mailing list