fix: complete readline prompt coverage

This commit is contained in:
Haoran
2026-08-25 21:56:24 +08:00
parent b99447946d
commit 922265145b
29 changed files with 387 additions and 191 deletions

View File

@@ -105,7 +105,8 @@ if __name__ == "__main__":
history = []
while True:
try:
query = input("\033[36ms01 >> \033[0m")
# \001/\002 tell Readline the ANSI escapes have zero display width.
query = input("\001\033[36m\002s01 >> \001\033[0m\002")
except (EOFError, KeyboardInterrupt):
break
if query.strip().lower() in ("q", "exit", ""):

View File

@@ -23,6 +23,12 @@ import os
import subprocess
from pathlib import Path
try:
import readline
readline.parse_and_bind('set bind-tty-special-chars off')
except ImportError:
pass
from anthropic import Anthropic
from dotenv import load_dotenv
@@ -136,7 +142,8 @@ if __name__ == "__main__":
history = []
while True:
try:
query = input("\033[36ms02 >> \033[0m")
# \001/\002 tell Readline the ANSI escapes have zero display width.
query = input("\001\033[36m\002s02 >> \001\033[0m\002")
except (EOFError, KeyboardInterrupt):
break
if query.strip().lower() in ("q", "exit", ""):

View File

@@ -31,6 +31,12 @@ import os
import subprocess
from pathlib import Path
try:
import readline
readline.parse_and_bind('set bind-tty-special-chars off')
except ImportError:
pass
from anthropic import Anthropic
from dotenv import load_dotenv
@@ -196,7 +202,8 @@ if __name__ == "__main__":
history = []
while True:
try:
query = input("\033[36ms03 >> \033[0m")
# \001/\002 tell Readline the ANSI escapes have zero display width.
query = input("\001\033[36m\002s03 >> \001\033[0m\002")
except (EOFError, KeyboardInterrupt):
break
if query.strip().lower() in ("q", "exit", ""):

View File

@@ -27,6 +27,12 @@ import os
import subprocess
from pathlib import Path
try:
import readline
readline.parse_and_bind('set bind-tty-special-chars off')
except ImportError:
pass
from anthropic import Anthropic
from dotenv import load_dotenv
@@ -172,7 +178,8 @@ if __name__ == "__main__":
history = []
while True:
try:
query = input("\033[36ms04 >> \033[0m")
# \001/\002 tell Readline the ANSI escapes have zero display width.
query = input("\001\033[36m\002s04 >> \001\033[0m\002")
except (EOFError, KeyboardInterrupt):
break
if query.strip().lower() in ("q", "exit", ""):

View File

@@ -41,6 +41,12 @@ import subprocess
import yaml
from pathlib import Path
try:
import readline
readline.parse_and_bind('set bind-tty-special-chars off')
except ImportError:
pass
from anthropic import Anthropic
from dotenv import load_dotenv
@@ -212,7 +218,8 @@ if __name__ == "__main__":
history = []
while True:
try:
query = input("\033[36ms05 >> \033[0m")
# \001/\002 tell Readline the ANSI escapes have zero display width.
query = input("\001\033[36m\002s05 >> \001\033[0m\002")
except (EOFError, KeyboardInterrupt):
break
if query.strip().lower() in ("q", "exit", ""):

View File

@@ -40,6 +40,12 @@ import subprocess
import time
from pathlib import Path
try:
import readline
readline.parse_and_bind('set bind-tty-special-chars off')
except ImportError:
pass
from anthropic import Anthropic
from dotenv import load_dotenv
@@ -247,7 +253,8 @@ if __name__ == "__main__":
history = []
while True:
try:
query = input("\033[36ms06 >> \033[0m")
# \001/\002 tell Readline the ANSI escapes have zero display width.
query = input("\001\033[36m\002s06 >> \001\033[0m\002")
except (EOFError, KeyboardInterrupt):
break
if query.strip().lower() in ("q", "exit", ""):

View File

@@ -27,6 +27,12 @@ import os
import subprocess
from pathlib import Path
try:
import readline
readline.parse_and_bind('set bind-tty-special-chars off')
except ImportError:
pass
from anthropic import Anthropic
from dotenv import load_dotenv
@@ -228,7 +234,8 @@ if __name__ == "__main__":
history = []
while True:
try:
query = input("\033[36ms07 >> \033[0m")
# \001/\002 tell Readline the ANSI escapes have zero display width.
query = input("\001\033[36m\002s07 >> \001\033[0m\002")
except (EOFError, KeyboardInterrupt):
break
if query.strip().lower() in ("q", "exit", ""):

View File

@@ -31,6 +31,12 @@ import threading
import uuid
from pathlib import Path
try:
import readline
readline.parse_and_bind('set bind-tty-special-chars off')
except ImportError:
pass
from anthropic import Anthropic
from dotenv import load_dotenv
@@ -246,7 +252,8 @@ if __name__ == "__main__":
history = []
while True:
try:
query = input("\033[36ms08 >> \033[0m")
# \001/\002 tell Readline the ANSI escapes have zero display width.
query = input("\001\033[36m\002s08 >> \001\033[0m\002")
except (EOFError, KeyboardInterrupt):
break
if query.strip().lower() in ("q", "exit", ""):

View File

@@ -50,6 +50,12 @@ import threading
import time
from pathlib import Path
try:
import readline
readline.parse_and_bind('set bind-tty-special-chars off')
except ImportError:
pass
from anthropic import Anthropic
from dotenv import load_dotenv
@@ -383,7 +389,8 @@ if __name__ == "__main__":
history = []
while True:
try:
query = input("\033[36ms09 >> \033[0m")
# \001/\002 tell Readline the ANSI escapes have zero display width.
query = input("\001\033[36m\002s09 >> \001\033[0m\002")
except (EOFError, KeyboardInterrupt):
break
if query.strip().lower() in ("q", "exit", ""):

View File

@@ -55,6 +55,12 @@ import time
import uuid
from pathlib import Path
try:
import readline
readline.parse_and_bind('set bind-tty-special-chars off')
except ImportError:
pass
from anthropic import Anthropic
from dotenv import load_dotenv
@@ -464,7 +470,8 @@ if __name__ == "__main__":
history = []
while True:
try:
query = input("\033[36ms10 >> \033[0m")
# \001/\002 tell Readline the ANSI escapes have zero display width.
query = input("\001\033[36m\002s10 >> \001\033[0m\002")
except (EOFError, KeyboardInterrupt):
break
if query.strip().lower() in ("q", "exit", ""):

View File

@@ -43,6 +43,12 @@ import time
import uuid
from pathlib import Path
try:
import readline
readline.parse_and_bind('set bind-tty-special-chars off')
except ImportError:
pass
from anthropic import Anthropic
from dotenv import load_dotenv
@@ -556,7 +562,8 @@ if __name__ == "__main__":
history = []
while True:
try:
query = input("\033[36ms11 >> \033[0m")
# \001/\002 tell Readline the ANSI escapes have zero display width.
query = input("\001\033[36m\002s11 >> \001\033[0m\002")
except (EOFError, KeyboardInterrupt):
break
if query.strip().lower() in ("q", "exit", ""):

View File

@@ -37,6 +37,12 @@ import subprocess
import time
from pathlib import Path
try:
import readline
readline.parse_and_bind('set bind-tty-special-chars off')
except ImportError:
pass
from anthropic import Anthropic
from dotenv import load_dotenv
@@ -767,7 +773,8 @@ if __name__ == "__main__":
history = []
while True:
try:
query = input("\033[36ms12 >> \033[0m")
# \001/\002 tell Readline the ANSI escapes have zero display width.
query = input("\001\033[36m\002s12 >> \001\033[0m\002")
except (EOFError, KeyboardInterrupt):
break
if query.strip().lower() in ("q", "exit", ""):

View File

@@ -46,6 +46,12 @@ import uuid
from pathlib import Path
from queue import Queue
try:
import readline
readline.parse_and_bind('set bind-tty-special-chars off')
except ImportError:
pass
from anthropic import Anthropic
from dotenv import load_dotenv
@@ -743,7 +749,8 @@ if __name__ == "__main__":
history = []
while True:
try:
query = input("\033[36ms_full >> \033[0m")
# \001/\002 tell Readline the ANSI escapes have zero display width.
query = input("\001\033[36m\002s_full >> \001\033[0m\002")
except (EOFError, KeyboardInterrupt):
break
if query.strip().lower() in ("q", "exit", ""):