mirror of
https://github.com/Aider-AI/aider.git
synced 2025-05-30 01:04:59 +00:00
fix: validate line_endings parameter in InputOutput initialization
This commit is contained in:
parent
a0e56c5282
commit
c22202585d
1 changed files with 6 additions and 0 deletions
|
@ -245,6 +245,12 @@ class InputOutput:
|
||||||
self.chat_history_file = None
|
self.chat_history_file = None
|
||||||
|
|
||||||
self.encoding = encoding
|
self.encoding = encoding
|
||||||
|
valid_line_endings = {"platform", "lf", "crlf"}
|
||||||
|
if line_endings not in valid_line_endings:
|
||||||
|
raise ValueError(
|
||||||
|
f"Invalid line_endings value: {line_endings}. "
|
||||||
|
f"Must be one of: {', '.join(valid_line_endings)}"
|
||||||
|
)
|
||||||
self.newline = None if line_endings == "platform" \
|
self.newline = None if line_endings == "platform" \
|
||||||
else "\n" if line_endings == "lf" else "\r\n"
|
else "\n" if line_endings == "lf" else "\r\n"
|
||||||
self.dry_run = dry_run
|
self.dry_run = dry_run
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue