在伪 Zsh 中添加清屏功能和最后登录时间显示
This commit is contained in:
5
main.py
5
main.py
@@ -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
|
||||
|
||||
|
||||
Reference in New Issue
Block a user