From a4be01b4744fd172959ddde8aa9569e791d57199 Mon Sep 17 00:00:00 2001 From: Paul Gauthier Date: Tue, 29 Oct 2024 13:59:41 -0700 Subject: [PATCH] refactor: move --load command execution before message processing --- aider/main.py | 6 +++--- aider/website/assets/sample.aider.conf.yml | 3 +++ aider/website/assets/sample.env | 3 +++ aider/website/docs/config/aider_conf.md | 3 +++ aider/website/docs/config/dotenv.md | 3 +++ aider/website/docs/config/options.md | 8 ++++++-- 6 files changed, 21 insertions(+), 5 deletions(-) diff --git a/aider/main.py b/aider/main.py index 3196bf52c..ce5fab404 100644 --- a/aider/main.py +++ b/aider/main.py @@ -748,6 +748,9 @@ def main(argv=None, input=None, output=None, force_git_root=None, return_coder=F io.tool_output(f"Cur working dir: {Path.cwd()}") io.tool_output(f"Git working dir: {git_root}") + if args.load: + commands.cmd_load(args.load) + if args.message: io.add_to_input_history(args.message) io.tool_output() @@ -770,9 +773,6 @@ def main(argv=None, input=None, output=None, force_git_root=None, return_coder=F return 1 return - if args.load: - commands.cmd_load(args.load) - if args.exit: return diff --git a/aider/website/assets/sample.aider.conf.yml b/aider/website/assets/sample.aider.conf.yml index e14f8273f..1c84973f6 100644 --- a/aider/website/assets/sample.aider.conf.yml +++ b/aider/website/assets/sample.aider.conf.yml @@ -329,6 +329,9 @@ ## Specify a file containing the message to send the LLM, process reply, then exit (disables chat mode) #message-file: xxx +## Load and execute /commands from a file on launch +#load: xxx + ## Specify the encoding for input and output (default: utf-8) #encoding: utf-8 diff --git a/aider/website/assets/sample.env b/aider/website/assets/sample.env index 70b2b2ed7..10929008e 100644 --- a/aider/website/assets/sample.env +++ b/aider/website/assets/sample.env @@ -315,6 +315,9 @@ ## Specify a file containing the message to send the LLM, process reply, then exit (disables chat mode) #AIDER_MESSAGE_FILE= +## Load and execute /commands from a file on launch +#AIDER_LOAD= + ## Specify the encoding for input and output (default: utf-8) #AIDER_ENCODING=utf-8 diff --git a/aider/website/docs/config/aider_conf.md b/aider/website/docs/config/aider_conf.md index e8819a806..ff514c184 100644 --- a/aider/website/docs/config/aider_conf.md +++ b/aider/website/docs/config/aider_conf.md @@ -385,6 +385,9 @@ cog.outl("```") ## Specify a file containing the message to send the LLM, process reply, then exit (disables chat mode) #message-file: xxx +## Load and execute /commands from a file on launch +#load: xxx + ## Specify the encoding for input and output (default: utf-8) #encoding: utf-8 diff --git a/aider/website/docs/config/dotenv.md b/aider/website/docs/config/dotenv.md index bcfa315b1..eb6cd07a2 100644 --- a/aider/website/docs/config/dotenv.md +++ b/aider/website/docs/config/dotenv.md @@ -357,6 +357,9 @@ cog.outl("```") ## Specify a file containing the message to send the LLM, process reply, then exit (disables chat mode) #AIDER_MESSAGE_FILE= +## Load and execute /commands from a file on launch +#AIDER_LOAD= + ## Specify the encoding for input and output (default: utf-8) #AIDER_ENCODING=utf-8 diff --git a/aider/website/docs/config/options.md b/aider/website/docs/config/options.md index 883f33cc6..54c69ffef 100644 --- a/aider/website/docs/config/options.md +++ b/aider/website/docs/config/options.md @@ -67,8 +67,8 @@ usage: aider [-h] [--openai-api-key] [--anthropic-api-key] [--model] [--check-update | --no-check-update] [--install-main-branch] [--upgrade] [--apply] [--yes-always] [-v] [--show-repo-map] [--show-prompts] - [--exit] [--message] [--message-file] [--encoding] [-c] - [--gui] + [--exit] [--message] [--message-file] [--load] + [--encoding] [-c] [--gui] [--suggest-shell-commands | --no-suggest-shell-commands] [--fancy-input | --no-fancy-input] [--voice-format] [--voice-language] @@ -595,6 +595,10 @@ Aliases: - `--message-file MESSAGE_FILE` - `-f MESSAGE_FILE` +### `--load LOAD_FILE` +Load and execute /commands from a file on launch +Environment variable: `AIDER_LOAD` + ### `--encoding VALUE` Specify the encoding for input and output (default: utf-8) Default: utf-8