Browse Source

parser: add superquiet flag that suppresses non-fatal warnings (https://trac.osgeo.org/grass/ticket/2967 - patch by rouault)

git-svn-id: https://svn.osgeo.org/grass/grass/trunk@68092 15284696-431f-4ddb-bdfa-cd5b030d7da7
Moritz Lennert 9 years ago
parent
commit
075dc2f9ec
2 changed files with 16 additions and 0 deletions
  1. 15 0
      lib/gis/parser.c
  2. 1 0
      lib/gis/parser_help.c

+ 15 - 0
lib/gis/parser.c

@@ -539,6 +539,21 @@ int G_parser(int argc, char **argv)
 		st->quiet = 1;	/* for passing to gui init */
 	    }
 
+            /* Super quiet option */
+            else if (strcmp(ptr, "--qq") == 0 ) {
+                char buff[32];
+
+                /* print nothing, but errors  */
+                st->module_info.verbose = G_verbose_min();
+                sprintf(buff, "GRASS_VERBOSE=%d", G_verbose_min());
+                putenv(G_store(buff));
+                G_suppress_warnings(TRUE);
+                if (st->quiet == -1) {
+                    G_warning(_("Use either --qq or --verbose flag, not both. Assuming --qq."));
+                }
+                st->quiet = 1;  /* for passing to gui init */
+            }
+
 	    /* Force gui to come up */
 	    else if (strcmp(ptr, "--ui") == 0) {
 		force_gui = TRUE;

+ 1 - 0
lib/gis/parser_help.c

@@ -202,6 +202,7 @@ static void usage(FILE *fp, int markers)
     fprintf(fp, " --h   %s\n", _("Print usage summary"));
     fprintf(fp, " --v   %s\n", _("Verbose module output"));
     fprintf(fp, " --q   %s\n", _("Quiet module output"));
+    fprintf(fp, " --qq  %s\n", _("Super quiet module output"));
     fprintf(fp, " --ui  %s\n", _("Force launching GUI dialog"));
     
     /* Print help info for options */