Skip to content

Commit 66121c9

Browse files
committed
refactor(cli): Simplify flag implementation using inverted add_invertible_flag
1 parent 23e5980 commit 66121c9

File tree

1 file changed

+7
-9
lines changed

1 file changed

+7
-9
lines changed

mypy/main.py

Lines changed: 7 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -998,6 +998,13 @@ def add_invertible_flag(
998998
help="Do not colorize error messages",
999999
group=error_group,
10001000
)
1001+
add_invertible_flag(
1002+
"--no-pretty",
1003+
default=True,
1004+
dest="pretty",
1005+
help="Disable pretty error message",
1006+
group=error_group,
1007+
)
10011008
add_invertible_flag(
10021009
"--no-error-summary",
10031010
dest="error_summary",
@@ -1018,15 +1025,6 @@ def add_invertible_flag(
10181025
dest="many_errors_threshold",
10191026
help=argparse.SUPPRESS,
10201027
)
1021-
error_group.add_argument(
1022-
"--no-pretty",
1023-
action="store_false",
1024-
dest="pretty",
1025-
help="Disable pretty error messages (pretty is now the default).",
1026-
)
1027-
error_group.add_argument(
1028-
"--pretty", action="store_true", dest="pretty", help=argparse.SUPPRESS
1029-
)
10301028

10311029
incremental_group = parser.add_argument_group(
10321030
title="Incremental mode",

0 commit comments

Comments
 (0)