Skip to content

Commit fcb3982

Browse files
ddfishergvanrossum
authored andcommitted
Join multiple -c flags into one multiline command (#2067)
1 parent b39edc2 commit fcb3982

File tree

1 file changed

+3
-2
lines changed

1 file changed

+3
-2
lines changed

mypy/main.py

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -226,7 +226,8 @@ def process_options(args: List[str],
226226
# TODO: `mypy -c A -c B` and `mypy -p A -p B` currently silently
227227
# ignore A (last option wins). Perhaps -c, -m and -p could just
228228
# be command-line flags that modify how we interpret self.files?
229-
code_group.add_argument('-c', '--command', metavar='PROGRAM_TEXT', dest='special-opts:command',
229+
code_group.add_argument('-c', '--command', action='append', metavar='PROGRAM_TEXT',
230+
dest='special-opts:command',
230231
help="type-check program passed in as string")
231232
code_group.add_argument('-p', '--package', metavar='PACKAGE', dest='special-opts:package',
232233
help="type-check all files in a directory")
@@ -294,7 +295,7 @@ def process_options(args: List[str],
294295
return targets, options
295296
elif special_opts.command:
296297
options.build_type = BuildType.PROGRAM_TEXT
297-
return [BuildSource(None, None, special_opts.command)], options
298+
return [BuildSource(None, None, '\n'.join(special_opts.command))], options
298299
else:
299300
targets = []
300301
for f in special_opts.files:

0 commit comments

Comments
 (0)