[GRASS-SVN] r58783 - in grass/trunk: gui/wxpython/core lib/gis

svn_grass at osgeo.org svn_grass at osgeo.org
Sun Jan 26 02:40:44 PST 2014


Author: neteler
Date: 2014-01-26 02:40:43 -0800 (Sun, 26 Jan 2014)
New Revision: 58783

Modified:
   grass/trunk/gui/wxpython/core/utils.py
   grass/trunk/lib/gis/parser.c
   grass/trunk/lib/gis/parser_help.c
   grass/trunk/lib/gis/parser_html.c
   grass/trunk/lib/gis/parser_interface.c
Log:
parser: support --h and --help in wxGUI command line (trac #2152)

Modified: grass/trunk/gui/wxpython/core/utils.py
===================================================================
--- grass/trunk/gui/wxpython/core/utils.py	2014-01-26 10:27:19 UTC (rev 58782)
+++ grass/trunk/gui/wxpython/core/utils.py	2014-01-26 10:40:43 UTC (rev 58783)
@@ -496,12 +496,12 @@
     if 'flags' in cmd[1]:
         for flag in cmd[1]['flags']:
             cmdList.append('-' + flag)
-    for flag in ('verbose', 'quiet', 'overwrite'):
+    for flag in ('help', 'verbose', 'quiet', 'overwrite'):
         if flag in cmd[1] and cmd[1][flag] is True:
             cmdList.append('--' + flag)
     
     for k, v in cmd[1].iteritems():
-        if k in ('flags', 'verbose', 'quiet', 'overwrite'):
+        if k in ('flags', 'help', 'verbose', 'quiet', 'overwrite'):
             continue
         cmdList.append('%s=%s' % (k, v))
             
@@ -519,7 +519,7 @@
             dcmd[str(key)] = str(value).replace('"', '')
         elif item[:2] == '--': # long flags
             flag = item[2:]
-            if flag in ('verbose', 'quiet', 'overwrite'):
+            if flag in ('help', 'verbose', 'quiet', 'overwrite'):
                 dcmd[str(flag)] = True
         elif len(item) == 2 and item[0] == '-': # -> flags
             if 'flags' not in dcmd:

Modified: grass/trunk/lib/gis/parser.c
===================================================================
--- grass/trunk/lib/gis/parser.c	2014-01-26 10:27:19 UTC (rev 58782)
+++ grass/trunk/lib/gis/parser.c	2014-01-26 10:40:43 UTC (rev 58783)
@@ -468,7 +468,7 @@
 	while (--argc) {
 	    ptr = *(++argv);
 
-	    if (strcmp(ptr, "help") == 0 ||
+	    if (strcmp(ptr, "help") == 0 || strcmp(ptr, "--h") == 0 ||
 		strcmp(ptr, "-help") == 0 || strcmp(ptr, "--help") == 0) {
 		G_usage();
 		exit(EXIT_SUCCESS);

Modified: grass/trunk/lib/gis/parser_help.c
===================================================================
--- grass/trunk/lib/gis/parser_help.c	2014-01-26 10:27:19 UTC (rev 58782)
+++ grass/trunk/lib/gis/parser_help.c	2014-01-26 10:40:43 UTC (rev 58783)
@@ -155,6 +155,9 @@
 	len = show(fp, item, len);
     }
 
+    strcpy(item, " [--help]");
+    len = show(fp, item, len);
+
     strcpy(item, " [--verbose]");
     len = show(fp, item, len);
 
@@ -193,6 +196,7 @@
 	fprintf(fp, " --o   %s\n",
 		_("Allow output files to overwrite existing files"));
 
+    fprintf(fp, " --h   %s\n", _("Print usage summary"));
     fprintf(fp, " --v   %s\n", _("Verbose module output"));
     fprintf(fp, " --q   %s\n", _("Quiet module output"));
 

Modified: grass/trunk/lib/gis/parser_html.c
===================================================================
--- grass/trunk/lib/gis/parser_html.c	2014-01-26 10:27:19 UTC (rev 58782)
+++ grass/trunk/lib/gis/parser_html.c	2014-01-26 10:40:43 UTC (rev 58783)
@@ -128,6 +128,7 @@
     if (new_prompt)
 	fprintf(stdout, " [--<b>overwrite</b>] ");
 
+    fprintf(stdout, " [--<b>help</b>] ");
     fprintf(stdout, " [--<b>verbose</b>] ");
     fprintf(stdout, " [--<b>quiet</b>] ");
 
@@ -165,6 +166,9 @@
 		    _("Allow output files to overwrite existing files"));
 	}
 
+	fprintf(stdout, "<dt><b>--help</b></dt>\n");
+	fprintf(stdout, "<dd>%s</dd>\n", _("Print usage summary"));
+
 	fprintf(stdout, "<dt><b>--verbose</b></dt>\n");
 	fprintf(stdout, "<dd>%s</dd>\n", _("Verbose module output"));
 

Modified: grass/trunk/lib/gis/parser_interface.c
===================================================================
--- grass/trunk/lib/gis/parser_interface.c	2014-01-26 10:27:19 UTC (rev 58782)
+++ grass/trunk/lib/gis/parser_interface.c	2014-01-26 10:40:43 UTC (rev 58783)
@@ -331,6 +331,13 @@
 	fprintf(stdout, "\t</flag>\n");
     }
 
+    /* help */
+    fprintf(stdout, "\t<flag name=\"%s\">\n", "help");
+    fprintf(stdout, "\t\t<description>\n\t\t\t");
+    print_escaped_for_xml(stdout, _("Print usage summary"));
+    fprintf(stdout, "\n\t\t</description>\n");
+    fprintf(stdout, "\t</flag>\n");
+
     /* verbose */
     fprintf(stdout, "\t<flag name=\"%s\">\n", "verbose");
     fprintf(stdout, "\t\t<description>\n\t\t\t");



More information about the grass-commit mailing list