mirror of
https://github.com/Aider-AI/aider.git
synced 2025-05-30 17:24:59 +00:00
aider: Add --encoding argument and pass it to InputOutput
.
# Aider chat conversation: USER: add --encoding and pass it to `InputOutput` ASSISTANT: To add the `--encoding` argument and pass it to `InputOutput`, we need to modify the `aider/main.py` file. Here are the steps: 1. Add a new argument `--encoding` to the `argparse.ArgumentParser` in the `main` function. 2. Pass the `args.encoding` to the `InputOutput` class instantiation. Here are the changes: ```python aider/main.py <<<<<<< HEAD ########## other_group = parser.add_argument_group("Other Settings") other_group.add_argument( "--version", action="version", version=f"%(prog)s {__version__}", help="Show the version number and exit", ) other_group.add_argument( "--apply", metavar="FILE", help="Apply the changes from the given file instead of running the chat (debug)", ) other_group.add_argument( "--yes", action="store_true", help="Always say yes to every confirmation", default=None, ) other_group.add_argument( "-v", "--verbose", action="store_true", help="Enable verbose output", default=False, ) other_group.add_argument( "--show-repo-map", action="store_true", help="Print the repo map and exit (debug)", default=False, ) other_group.add_argument( "--message", "--msg", "-m", metavar="COMMAND", help="Specify a single message to send GPT, process reply then exit (disables chat mode)", ) other_group.add_argument( "-c", "--config", is_config_file=True, metavar="CONFIG_FILE", help=( "Specify the config file (default: search for .aider.conf.yml in git root, cwd" " or home directory)" ), ) args = parser.parse_args(argv) ======= ########## other_group = parser.add_argument_group("Other Settings") other_group.add_argument( "--version", action="version", version=f"%(prog)s {__version__}", help="Show the version number and exit", ) other_group.add_argument( "--apply", metavar="FILE", help="Apply the changes from the given file instead of running the chat (debug)", ) other_group.add_argument( "--yes", action="store_true", help="Always say yes to every confirmation", default=None, ) other_group.add_argument( "-v", "--verbose", action="store_true", help="Enable verbose output", default=False, ) other_group.add_argument( "--show-repo-map", action="store_true", help="Print the repo map and exit (debug)", default=False, ) other_group.add_argument( "--message", "--msg", "-m", 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", is_config_file=True, metavar="CONFIG_FILE", help=( "Specify the config file (default: search for .aider.conf.yml in git root, cwd" " or home directory)" ), ) args = parser.parse_args(argv) >>>>>>> updated ``` ```python aider/main.py <<<<<<< HEAD io = InputOutput( args.pretty, args.yes, args.input_history_file, args.chat_history_file, input=input, output=output, user_input_color=args.user_input_color, tool_output_color=args.tool_output_color, tool_error_color=args.tool_error_color, dry_run=args.dry_run, ) ======= io = InputOutput( args.pretty, args.yes, args.input_history_file, args.chat_history_file, input=input, output=output, user_input_color=args.user_input_color, tool_output_color=args.tool_output_color, tool_error_color=args.tool_error_color, dry_run=args.dry_run, encoding=args.encoding, ) >>>>>>> updated ``` Please note that the `InputOutput` class should be able to handle the `encoding` argument. If it's not the case, we need to modify the `InputOutput` class as well.
This commit is contained in:
parent
cd30e531be
commit
ac9160ae54
1 changed files with 6 additions and 0 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]
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue