Skip to content

Commit d70b510

Browse files
MercuryDemoDimitriPapadopoulos
authored andcommitted
Enforce --write-changes in interactive mode
By modifying the initial value of interactive and directly modifying the value of write_changes when the user selects the interactive model But I don't think this is the best solution, because codespell doesn't make any limitations on the value of interactive entered by the user, while the execution only supports 0, 1, 2, 3.
1 parent 2569d89 commit d70b510

File tree

1 file changed

+4
-1
lines changed

1 file changed

+4
-1
lines changed

codespell_lib/_codespell.py

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -507,7 +507,7 @@ def parse_options(
507507
"--interactive",
508508
action="store",
509509
type=int,
510-
default=0,
510+
default=-1,
511511
help="set interactive mode when writing changes:\n"
512512
"- 0: no interactivity.\n"
513513
"- 1: ask for confirmation.\n"
@@ -1139,6 +1139,9 @@ def main(*args: str) -> int:
11391139
for ifile, cfg_file in enumerate(used_cfg_files, start=1):
11401140
print(f" {ifile}: {cfg_file}")
11411141

1142+
if options.interactive >= 0:
1143+
options.write_changes = True
1144+
11421145
if options.regex and options.write_changes:
11431146
print(
11441147
"ERROR: --write-changes cannot be used together with --regex",

0 commit comments

Comments
 (0)