Renamed getinput -> io

This commit is contained in:
Paul Gauthier 2023-05-17 13:41:58 -07:00
parent 7b04f5ab8d
commit 11c0dd89d9
2 changed files with 9 additions and 10 deletions

View file

@ -9,7 +9,6 @@ from prompt_toolkit.history import FileHistory
from prompt_toolkit.shortcuts import CompleteStyle from prompt_toolkit.shortcuts import CompleteStyle
from rich.console import Console from rich.console import Console
from rich.text import Text from rich.text import Text
import sys
import time import time
import random import random
from pathlib import Path from pathlib import Path
@ -68,7 +67,7 @@ class InputOutput:
self.console = Console(force_terminal=True, no_color=True) self.console = Console(force_terminal=True, no_color=True)
current_time = datetime.now().strftime("%Y-%m-%d %H:%M:%S") current_time = datetime.now().strftime("%Y-%m-%d %H:%M:%S")
self.append_chat_history(f'\n# Aider chat started at {current_time}\n\n') self.append_chat_history(f"\n# Aider chat started at {current_time}\n\n")
def canned_input(self, show_prompt): def canned_input(self, show_prompt):
console = Console() console = Console()
@ -105,7 +104,7 @@ class InputOutput:
show += "\n" show += "\n"
show += "> " show += "> "
#if not sys.stdin.isatty(): # if not sys.stdin.isatty():
# return self.canned_input(show) # return self.canned_input(show)
inp = "" inp = ""
@ -146,7 +145,7 @@ class InputOutput:
if inp: if inp:
hist = inp.splitlines() hist = inp.splitlines()
else: else:
hist = ['<blank>'] hist = ["<blank>"]
hist = f" \n{prefix} ".join(hist) hist = f" \n{prefix} ".join(hist)
@ -160,7 +159,7 @@ class InputOutput:
# OUTPUT # OUTPUT
def ai_output(self, content): def ai_output(self, content):
hist = '\n' + content.strip() + '\n\n' hist = "\n" + content.strip() + "\n\n"
self.append_chat_history(hist) self.append_chat_history(hist)
def confirm_ask(self, question, default="y"): def confirm_ask(self, question, default="y"):
@ -178,7 +177,7 @@ class InputOutput:
def prompt_ask(self, question, default=None): def prompt_ask(self, question, default=None):
if self.yes: if self.yes:
res = 'yes' res = "yes"
else: else:
res = prompt(question + " ", default=default) res = prompt(question + " ", default=default)
@ -207,11 +206,11 @@ class InputOutput:
def append_chat_history(self, text, linebreak=False, blockquote=False): def append_chat_history(self, text, linebreak=False, blockquote=False):
if blockquote: if blockquote:
text = text.strip() text = text.strip()
text = '> ' + text text = "> " + text
if linebreak: if linebreak:
text = text.rstrip() text = text.rstrip()
text = text + " \n" text = text + " \n"
if not text.endswith('\n'): if not text.endswith("\n"):
text += '\n' text += "\n"
with self.chat_history_file.open("a") as f: with self.chat_history_file.open("a") as f:
f.write(text) f.write(text)

View file

@ -3,7 +3,7 @@ import sys
import argparse import argparse
from dotenv import load_dotenv from dotenv import load_dotenv
from aider.coder import Coder from aider.coder import Coder
from aider.getinput import InputOutput from aider.io import InputOutput
def main(args=None, input=None, output=None): def main(args=None, input=None, output=None):