Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 6 additions & 0 deletions aider/args.py
Original file line number Diff line number Diff line change
Expand Up @@ -653,6 +653,12 @@ def get_parser(default_config_files, git_root):
" (disables chat mode)"
),
).complete = shtab.FILE
group.add_argument(
"--one-shot",
action="store_true",
default=False,
help="Run a single prompt without git repo, then exit (implies --no-git)",
)
group.add_argument(
"--gui",
"--browser",
Expand Down
11 changes: 11 additions & 0 deletions aider/main.py
Original file line number Diff line number Diff line change
Expand Up @@ -676,6 +676,17 @@ def get_io(pretty):
for fname in loaded_dotenvs:
io.tool_output(f"Loaded {fname}")

if args.one_shot:
args.git = False
if not args.message and not args.message_file:
if args.files:
# Use the first positional arg as the message
args.message = args.files.pop(0)
else:
io.tool_error("--one-shot requires a message, use --message or --message-file")
analytics.event("exit", reason="One-shot without message")
return 1

all_files = args.files + (args.file or [])
fnames = [str(Path(fn).resolve()) for fn in all_files]
read_only_fnames = []
Expand Down