Преглед на файлове

parser: do not show empty flags section

Vaclav Petras преди 6 години
родител
ревизия
d8d5cc7113
променени са 1 файла, в които са добавени 12 реда и са изтрити 4 реда
  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 */
 
-    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) {
 	flag = &st->first_flag;