From 8bc0d5544d0bb656a028407dbf14fb187151e529 Mon Sep 17 00:00:00 2001 From: "Paul Gauthier (aider)" Date: Mon, 4 Nov 2024 10:34:21 -0800 Subject: [PATCH] feat: add --apply-clipboard-edits switch for direct clipboard editing --- aider/args.py | 6 ++++++ aider/main.py | 5 ++++- 2 files changed, 10 insertions(+), 1 deletion(-) diff --git a/aider/args.py b/aider/args.py index c02254e4960..852b42ee2e8 100644 --- a/aider/args.py +++ b/aider/args.py @@ -630,6 +630,12 @@ def get_parser(default_config_files, git_root): metavar="FILE", help="Apply the changes from the given file instead of running the chat (debug)", ) + group.add_argument( + "--apply-clipboard-edits", + action="store_true", + help="Apply clipboard contents as edits using the main model's editor format", + default=False, + ) group.add_argument( "--yes-always", action="store_true", diff --git a/aider/main.py b/aider/main.py index 9ad59dc0b54..463400a38d7 100644 --- a/aider/main.py +++ b/aider/main.py @@ -1,4 +1,3 @@ -#ai: add a --apply-clipboard-edits switch which sets the edit-format to the main models editor format and acts as if "--msg /paste" was provided as an arg! import configparser import json @@ -776,6 +775,10 @@ def get_io(pretty): coder.apply_updates() return + if args.apply_clipboard_edits: + args.edit_format = main_model.editor_edit_format + args.message = "/paste" + if "VSCODE_GIT_IPC_HANDLE" in os.environ: args.pretty = False io.tool_output("VSCode terminal detected, pretty output has been disabled.")