在伪 Zsh 中添加清屏功能和最后登录时间显示

This commit is contained in:
2025-04-02 14:02:46 +08:00
Unverified
parent b4777f9023
commit 1422737150

View File

@@ -21,6 +21,9 @@ def pseudo_zsh():
sys.stdout.write("\033]0;zsh\007") # 使用 ANSI 转义序列设置标题
sys.stdout.flush()
os.system("clear") # 清屏
print(f"Last login: {datetime.now().strftime('%a %b %d %H:%M:%S %Y')} on ttys000\n")
while True:
try:
dir = os.getcwd()
@@ -75,7 +78,7 @@ def pseudo_zsh():
except FileNotFoundError:
print(f"zsh: command not found: {args[0]}")
except KeyboardInterrupt:
print("\nUse 'hxl' to exit.")
break
except EOFError:
break