Skip to content

Commit fcfe296

Browse files
authored
Simpler argument handling for debug flag (#1975)
supports direct assignment with --debug=False or --debug=True, but will also support --debug to set True or --no-debug to set False. Default value if not set is false. Issue #, if available: N/A Description of changes: removes default false value and adds builtin argparse.BooleanOptionalAction to the debug flag action. From https://docs.python.org/dev/library/argparse.html#action : > "New in version 3.8. > > You may also specify an arbitrary action by passing an Action subclass or other object that implements the same interface. The BooleanOptionalAction is now available in argparse and adds support for boolean actions such as --foo and --no-foo" By submitting this pull request, I confirm that my contribution is made under the terms of the Apache 2.0 license.
1 parent bf501ab commit fcfe296

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

docs/scripts/gen_services.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -170,7 +170,7 @@ def main(
170170

171171
if __name__ == "__main__":
172172
parser = argparse.ArgumentParser(description="Generate documentation service release phase pages")
173-
parser.add_argument("--debug", type=bool, default=False,
173+
parser.add_argument("--debug", action=argparse.BooleanOptionalAction,
174174
help="Enables debugging logging")
175175
parser.add_argument("--page_output_path", type=str, default="./content/docs/community",
176176
help="Relative path to the documentation output directory, relative to the `docs` directory")

0 commit comments

Comments
 (0)