Skip to content

Commit

Permalink
Enforce --write-changes in interactive mode
Browse files Browse the repository at this point in the history
  • Loading branch information
MercuryDemo authored and DimitriPapadopoulos committed Jul 26, 2024
1 parent a28e3c7 commit 7305877
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 2 deletions.
3 changes: 3 additions & 0 deletions codespell_lib/_codespell.py
Original file line number Diff line number Diff line change
Expand Up @@ -1126,6 +1126,9 @@ def main(*args: str) -> int:
for ifile, cfg_file in enumerate(used_cfg_files, start=1):
print(f" {ifile}: {cfg_file}")

if options.interactive > 0:
options.write_changes = True

if options.regex and options.write_changes:
return _usage_error(
parser,
Expand Down
2 changes: 0 additions & 2 deletions codespell_lib/tests/test_basic.py
Original file line number Diff line number Diff line change
Expand Up @@ -243,8 +243,6 @@ def test_interactivity(
cs.main("-i", "-1", fname)
assert e.type is SystemExit
assert e.value.code != 0
with FakeStdin("y\n"):
assert cs.main("-i", "3", fname) == 1
with FakeStdin("n\n"):
result = cs.main("-w", "-i", "3", fname, std=True)
assert isinstance(result, tuple)
Expand Down

0 comments on commit 7305877

Please sign in to comment.