mirror of
https://github.com/Aider-AI/aider.git
synced 2025-05-30 17:24:59 +00:00
Merge branch 'main' into sitter-map
This commit is contained in:
commit
4654e81241
2 changed files with 23 additions and 2 deletions
|
@ -378,6 +378,11 @@ def main(argv=None, input=None, output=None, force_git_root=None):
|
|||
metavar="COMMAND",
|
||||
help="Specify a single message to send GPT, process reply then exit (disables chat mode)",
|
||||
)
|
||||
other_group.add_argument(
|
||||
"--encoding",
|
||||
default="utf-8",
|
||||
help="Specify the encoding for input and output (default: utf-8)",
|
||||
)
|
||||
other_group.add_argument(
|
||||
"-c",
|
||||
"--config",
|
||||
|
@ -414,6 +419,7 @@ def main(argv=None, input=None, output=None, force_git_root=None):
|
|||
tool_output_color=args.tool_output_color,
|
||||
tool_error_color=args.tool_error_color,
|
||||
dry_run=args.dry_run,
|
||||
encoding=args.encoding,
|
||||
)
|
||||
|
||||
fnames = [str(Path(fn).resolve()) for fn in args.files]
|
||||
|
|
|
@ -4,7 +4,7 @@ import subprocess
|
|||
import tempfile
|
||||
from pathlib import Path
|
||||
from unittest import TestCase
|
||||
from unittest.mock import patch
|
||||
from unittest.mock import MagicMock, patch
|
||||
|
||||
import git
|
||||
from prompt_toolkit.input import DummyInput
|
||||
|
@ -13,7 +13,7 @@ from prompt_toolkit.output import DummyOutput
|
|||
from aider.dump import dump # noqa: F401
|
||||
from aider.io import InputOutput
|
||||
from aider.main import check_gitignore, main, setup_git
|
||||
from tests.utils import make_repo
|
||||
from tests.utils import GitTemporaryDirectory, make_repo
|
||||
|
||||
|
||||
class TestMain(TestCase):
|
||||
|
@ -178,3 +178,18 @@ class TestMain(TestCase):
|
|||
main(["--dirty-commits"], input=DummyInput())
|
||||
_, kwargs = MockCoder.call_args
|
||||
assert kwargs["dirty_commits"] is True
|
||||
|
||||
def test_encodings_arg(self):
|
||||
fname = "foo.py"
|
||||
|
||||
with GitTemporaryDirectory():
|
||||
with patch("aider.main.Coder.create") as MockCoder: # noqa: F841
|
||||
with patch("aider.main.InputOutput") as MockSend:
|
||||
|
||||
def side_effect(*args, **kwargs):
|
||||
self.assertEqual(kwargs["encoding"], "iso-8859-15")
|
||||
return MagicMock()
|
||||
|
||||
MockSend.side_effect = side_effect
|
||||
|
||||
main(["--yes", fname, "--encoding", "iso-8859-15"])
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue