Skip to content

Commit

Permalink
fix: Default values for CLI arguments not aligned with documentation.
Browse files Browse the repository at this point in the history
Fixes #2642

Signed-off-by: Frost Ming <[email protected]>
  • Loading branch information
frostming committed Feb 26, 2024
1 parent 0ae5611 commit aa2ed00
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 1 deletion.
5 changes: 4 additions & 1 deletion docs/docs/reference/cli.md
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,10 @@ def render_parser(
line += f" `{action.metavar}`"
line += f": {clean_help(action.help)}"
if action.default and action.default != argparse.SUPPRESS:
line += f" (default: `{action.default}`)"
default = action.default
if any(opt.startswith("--no-") for opt in action.option_strings) and default is True:
default = not default
line += f" (default: `{default}`)"
result.append(line)
result.append("")

Expand Down
1 change: 1 addition & 0 deletions news/2642.doc.md
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
Fix the default value for negative CLI flags.

0 comments on commit aa2ed00

Please sign in to comment.