mirror of
https://github.com/Aider-AI/aider.git
synced 2025-06-04 11:45:00 +00:00
refactored into getinput
This commit is contained in:
parent
6419e6c390
commit
82cf653d73
3 changed files with 64 additions and 59 deletions
35
utils.py
35
utils.py
|
@ -107,38 +107,3 @@ def do_replace(fname, before_text, after_text):
|
|||
|
||||
fname.write_text(new_content)
|
||||
return True
|
||||
def get_input(history_file, fnames):
|
||||
inp = ""
|
||||
multiline_input = False
|
||||
|
||||
style = Style.from_dict({'': 'green'})
|
||||
|
||||
while True:
|
||||
completer_instance = FileContentCompleter(fnames)
|
||||
if multiline_input:
|
||||
show = ". "
|
||||
else:
|
||||
show = "> "
|
||||
|
||||
try:
|
||||
line = prompt(
|
||||
show,
|
||||
completer=completer_instance,
|
||||
history=FileHistory(history_file),
|
||||
style=style,
|
||||
)
|
||||
except EOFError:
|
||||
return
|
||||
if line.strip() == "{" and not multiline_input:
|
||||
multiline_input = True
|
||||
continue
|
||||
elif line.strip() == "}" and multiline_input:
|
||||
break
|
||||
elif multiline_input:
|
||||
inp += line + "\n"
|
||||
else:
|
||||
inp = line
|
||||
break
|
||||
|
||||
print()
|
||||
return inp
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue