diff --git a/main.py b/main.py index e2023a1..0aa0fc1 100644 --- a/main.py +++ b/main.py @@ -73,17 +73,24 @@ def pseudo_zsh(): except FileNotFoundError: print(f"cd: no such file or directory: {args[1]}") # 目录不存在 continue - if args[0] == 'ls': - if len(args) == 1: - args.append('-l') # 默认参数 - subprocess.run(['ls'] + args[1:]) # 执行 ls 命令 + if args[0] == 'l': - if len(args) == 1: - args.append('-l') - subprocess.run(['ls'] + args[1:]) + subprocess.run(['ls','-l']) # 执行 ls 命令 + if args[0] == 'ssh1': subprocess.run(['ssh','root@10.147.17.161']) - if args[0] == 'sudo': + + if args[0] == 'update': + try: + subprocess.run(['git', 'pull']) + subprocess.run(['git', 'push']) + print("Code synchronized successfully.") + print("Restarting the program...") + os.execv(sys.executable, ['python3'] + sys.argv) # 重新运行程序 + except Exception as e: + print(f"Error during update: {e}") + + if args[0] == 'sudo': flight1 = True a = 0 for attempt in range(3): # 循环 3 次