Forráskód Böngészése

parser: do not show empty flags section

Vaclav Petras 5 éve
szülő
commit
d8d5cc7113
1 módosított fájl, 12 hozzáadás és 4 törlés
  1. 12 4
      lib/gis/parser_help.c

+ 12 - 4
lib/gis/parser_help.c

@@ -185,10 +185,18 @@ static void usage(FILE *fp, int markers)
 
 
     /* Print help info for flags */
     /* Print help info for flags */
 
 
-    fprintf(fp, "\n");
-    if (markers)
-	fprintf(fp, "{{{FLAGS}}}\n");
-    fprintf(fp, "%s\n", _("Flags:"));
+    /* Show section only when there are flags.
+     * There are always the standard flags if we are printing those.
+     * There is no use case for the markers, so no way to decide if
+     * the marker for flags is mandatory and should be empty if it is
+     * okay for it to be missing like in the current implementation.
+     */
+    if (st->n_flags || standard) {
+	fprintf(fp, "\n");
+	if (markers)
+	    fprintf(fp, "{{{FLAGS}}}\n");
+	fprintf(fp, "%s\n", _("Flags:"));
+    }
 
 
     if (st->n_flags) {
     if (st->n_flags) {
 	flag = &st->first_flag;
 	flag = &st->first_flag;