Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion docs/source/command_line.rst
Original file line number Diff line number Diff line change
Expand Up @@ -101,7 +101,7 @@ Optional arguments

Show program's version number and exit.

.. option:: -O FORMAT, --output FORMAT {json}
.. option:: -O {json}, --output {json}

Set a custom output format.

Expand Down
8 changes: 3 additions & 5 deletions mypy/main.py
Original file line number Diff line number Diff line change
Expand Up @@ -568,11 +568,7 @@ def add_invertible_flag(
)

general_group.add_argument(
"-O",
"--output",
metavar="FORMAT",
help="Set a custom output format",
choices=OUTPUT_CHOICES,
"-O", "--output", help="Set a custom output format", choices=sorted(OUTPUT_CHOICES)
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

(Informational:) an alternate form I considered for this code was

        "-O",
        "--output",
        metavar="FORMAT",
        # The metavar overrides the default of displaying the choices,
        # so we have to explicitly display them.
        help=f"Set a custom output format (choices: {set(OUTPUT_CHOICES.keys())})",
        choices=OUTPUT_CHOICES,

However, I ultimately decided that just letting it do its default thing was better.

)

config_group = parser.add_argument_group(
Expand Down Expand Up @@ -1108,6 +1104,8 @@ def add_invertible_flag(
parser.add_argument(
"--enable-incomplete-feature",
action="append",
# We can't just use choices= here because we actually accept more than this;
# see process_incomplete_features.
metavar="{" + ",".join(sorted(INCOMPLETE_FEATURES)) + "}",
help="Enable support of incomplete/experimental features for early preview",
)
Expand Down
Loading