Skip to content

Commit b6f5536

Browse files
authored
lib/parser: Use None as default for overwrite (#6076)
Use None, not False, as a default value for overwrite, verbose etc. None is more appropriate because the default behavior is influenced by the environment and, very generally, by how the library is set up. While False is correct in terms of the corresponding command line not being set, the False value may create a false perception that overwriting will be disabled, but in fact overwriting will be driven by the environment.
1 parent 8adc66e commit b6f5536

File tree

1 file changed

+7
-5
lines changed

1 file changed

+7
-5
lines changed

lib/gis/parser_md_python.c

Lines changed: 7 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -76,7 +76,8 @@ void print_python_long_flag(FILE *file, const char *key, const char *label,
7676
}
7777
fprintf(file, "%s", indent);
7878
G__md_print_escaped(file, "\t");
79-
fprintf(file, "Default: *False*");
79+
const char *flag_default = "*None*";
80+
fprintf(file, "Default: %s", flag_default);
8081
}
8182

8283
void print_python_tuple(FILE *file, const char *type, int num_items)
@@ -436,12 +437,13 @@ void G__md_print_python_short_version(FILE *file, const char *indent)
436437
fprintf(file, "%s **flags**=*None*,\n", indent);
437438
}
438439

440+
const char *flag_default = "*None*";
439441
if (new_prompt)
440-
fprintf(file, "%s **overwrite**=*False*,\n", indent);
442+
fprintf(file, "%s **overwrite**=%s,\n", indent, flag_default);
441443

442-
fprintf(file, "%s **verbose**=*False*,\n", indent);
443-
fprintf(file, "%s **quiet**=*False*,\n", indent);
444-
fprintf(file, "%s **superquiet**=*False*)\n", indent);
444+
fprintf(file, "%s **verbose**=%s,\n", indent, flag_default);
445+
fprintf(file, "%s **quiet**=%s,\n", indent, flag_default);
446+
fprintf(file, "%s **superquiet**=%s)\n", indent, flag_default);
445447

446448
print_python_example(file, python_function, output_format_default, indent);
447449
}

0 commit comments

Comments
 (0)