[GRASS-SVN] r72755 - sandbox/wenzeslaus/g.citation
svn_grass at osgeo.org
svn_grass at osgeo.org
Thu May 31 19:43:23 PDT 2018
Author: wenzeslaus
Date: 2018-05-31 19:43:23 -0700 (Thu, 31 May 2018)
New Revision: 72755
Modified:
sandbox/wenzeslaus/g.citation/g.citation.py
Log:
g.citation: flag to use all core modules
Modified: sandbox/wenzeslaus/g.citation/g.citation.py
===================================================================
--- sandbox/wenzeslaus/g.citation/g.citation.py 2018-06-01 02:36:14 UTC (rev 72754)
+++ sandbox/wenzeslaus/g.citation/g.citation.py 2018-06-01 02:43:23 UTC (rev 72755)
@@ -29,7 +29,6 @@
#% key: module
#% type: string
#% description: GRASS GIS module to be cited
-#% required: yes
#% multiple: no
#%end
@@ -50,6 +49,16 @@
#% required: no
#%end
+#%flag
+#% key: a
+#% description: Provide citation for all modules
+#%end
+
+#%rules
+#% required: module,-a
+#% exclusive: module,-a
+#%end
+
# TODO: if output is provided, write to ascii file
# (otherwise print to command line)
# TODO: Find lhmpom-equivalent in GRASS repository
@@ -265,6 +274,13 @@
return citation
+def get_core_modules():
+ # TODO: see what get_commands() does on MS Windows
+ modules = list(gs.get_commands()[0])
+ modules.sort()
+ return modules
+
+
def main(options, flags):
"""Main function to do the module's work
@@ -272,14 +288,16 @@
functions.
"""
- name = options['module']
+ if options['module']:
+ names = options['module'].split(',')
+ if flags['a']:
+ names = get_core_modules()
output_format = options['format']
- citation = citation_for_module(name)
+ for name in names:
+ citation = citation_for_module(name)
+ print_citation(citation, output_format)
- print_citation(citation, output_format)
-
-
# TODO: consider "Extended by" versus original authors
# LASTCHANGED, COPYRIGHT-YEARS, COPRIGHT-ENTITY
More information about the grass-commit
mailing list