更新 main.py,优化 PyShell 目录判断逻辑并简化终端窗口标题设置

This commit is contained in:
2025-04-02 18:36:37 +08:00
Unverified
parent e707b4f615
commit 43c976edb9

View File

@@ -34,7 +34,7 @@ def pseudo_zsh():
else:
CmdDir = dir.split('/')[-1]
if CmdDir == 'PyShell' :
if dir.split('/')[-1] == 'PyShell' :
CmdDir == '~/'
# 显示提示符并获取用户输入
@@ -82,7 +82,7 @@ def pseudo_zsh():
print(f"zsh: command not found: {args[0]}")
# 修改终端窗口标题
sys.stdout.write(f"\033]0;{CmdDir}-zsh\007") # 使用 ANSI 转义序列设置标题
sys.stdout.write(f"\033]0;zsh\007") # 使用 ANSI 转义序列设置标题
sys.stdout.flush()
except KeyboardInterrupt:
print(f"^C")