diff --git a/src/com2ann.py b/src/com2ann.py
index 5e41a5f..f6d0f48 100644
--- a/src/com2ann.py
+++ b/src/com2ann.py
@@ -936,8 +936,8 @@ def main() -> None:
     options = Options(**args)
 
     for infile in infiles:
-        outfile = outfile or infile
-        process_single_entry(in_path=infile, out_path=outfile, options=options)
+        cur_outfile = outfile or infile
+        process_single_entry(in_path=infile, out_path=cur_outfile, options=options)
 
 
 if __name__ == '__main__':

diff --git a/src/test_cli.py b/src/test_cli.py
index 29f63ef..abec360 100644
--- a/src/test_cli.py
+++ b/src/test_cli.py
@@ -2,6 +2,7 @@ from __future__ import annotations
 
 import os
 import pathlib
+from dataclasses import asdict
 from typing import Any, Callable, Iterable, TypedDict
 
 import pytest
@@ -216,3 +217,42 @@ def test_process_single_entry__dir(
             options=options,
         ),
     ]
+
+
+@pytest.fixture
+def parse_cli_args(
+    test_path: pathlib.Path,
+    mocker: Any,
+    options: com2ann.Options,
+) -> Any:
+    f1 = test_path / "f1.py"
+    f2 = test_path / "f2.py"
+
+    f1.write_text("f1 = True")
+    f2.write_text("f2 = False")
+
+    args = {'infiles': [f1, f2], 'outfile': None, **asdict(options)}
+    return mocker.patch("com2ann.parse_cli_args", return_value=args)
+
+
+def test_process_multiple_input_files(
+    test_path: pathlib.Path, translate_file: Any,
+    mocker: Any, parse_cli_args: Any,
+    options: com2ann.Options
+) -> None:
+    com2ann.main()
+
+    assert translate_file.mock_calls == [
+        mocker.call(
+            infile=str(test_path / "f1.py"),
+            outfile=str(test_path / "f1.py"),
+            options=options,
+        ),
+        mocker.call(
+            infile=str(test_path / "f2.py"),
+            outfile=str(test_path / "f2.py"),
+            options=options,
+        ),
+    ]
+    assert (test_path / "f1.py").read_text() == "f1 = True"
+    assert (test_path / "f2.py").read_text() == "f2 = False"

Multiple input files are generated to single file
When a command is called with multiple files (ex. `com2ann f1.py f2.py`), then the first file (`f1.py`) is chosen as output for both files.

This is especially problematic when `pre-commit` hook is used.
src/test_cli.py::test_process_multiple_input_files
src/test_cli.py::test_parse_cli_args__minimal src/test_cli.py::test_parse_cli_args__maximal src/test_cli.py::test_parse_cli_args__no_infile src/test_cli.py::test_parse_cli_args__missing_file src/test_cli.py::test_parse_cli_args__in_out_type_mismatch[file.py-dir] src/test_cli.py::test_parse_cli_args__in_out_type_mismatch[dir-file.py] src/test_cli.py::test_parse_cli_args__outfile_doesnt_exist src/test_cli.py::test_parse_cli_args__multiple_inputs_and_output src/test_cli.py::test_rebase_path src/test_cli.py::test_process_single_entry__file src/test_cli.py::test_process_single_entry__dir