From d3b07a124c9869e319b440666688cf8f86a90f68 Mon Sep 17 00:00:00 2001 From: m5rcel { Marcel } Date: Sat, 4 Oct 2025 11:54:02 +0200 Subject: [PATCH] Update cmd_exit.py --- commands/cmd_exit.py | 70 ++++++++++++++++++++++++++++++++++++++++++-- 1 file changed, 68 insertions(+), 2 deletions(-) diff --git a/commands/cmd_exit.py b/commands/cmd_exit.py index aea361b..c7c2e03 100644 --- a/commands/cmd_exit.py +++ b/commands/cmd_exit.py @@ -1,6 +1,72 @@ -from colorama import Fore +from colorama import Fore, Style +import time +import os +import sys class ExitCommand: + def shutdown_animation(self): + # Clear screen for clean shutdown + os.system('cls' if os.name == 'nt' else 'clear') + + # Shutdown sequence messages + shutdown_msgs = [ + "Stopping Discord RPC Integration...", + "Saving shell session...", + "Clearing command history...", + "Stopping background processes...", + "Unmounting m5rcode directories...", + "Finalizing cleanup...", + "Thank you for using m5rcode shell!" + ] + + print(Fore.LIGHTBLACK_EX + "m5rOS Shutdown Sequence" + Style.RESET_ALL) + print(Fore.LIGHTBLACK_EX + "=" * 25 + Style.RESET_ALL) + + for i, msg in enumerate(shutdown_msgs): + time.sleep(0.3) + if i == len(shutdown_msgs) - 1: + # Last message in cyan + print(Fore.CYAN + Style.BRIGHT + f"[ OK ] {msg}" + Style.RESET_ALL) + else: + # Regular messages in white/grey + color = Fore.WHITE if i % 2 == 0 else Fore.LIGHTBLACK_EX + print(color + f"[ OK ] {msg}" + Style.RESET_ALL) + + time.sleep(0.5) + + # Animated "powering down" effect + print() + sys.stdout.write(Fore.LIGHTMAGENTA_EX + "Powering down") + for _ in range(6): + time.sleep(0.2) + sys.stdout.write(".") + sys.stdout.flush() + + print(Style.RESET_ALL) + time.sleep(0.3) + + # Final goodbye box + box_width = 50 + print(Fore.MAGENTA + "╔" + "═" * (box_width - 2) + "╗") + + goodbye_lines = [ + "m5rcode shell session ended", + "", + "Thanks for coding with us!", + "See you next time! 👋" + ] + + for line in goodbye_lines: + if line == "": + print(Fore.MAGENTA + "║" + " " * (box_width - 2) + "║") + else: + color = Fore.CYAN if "m5rcode" in line else Fore.LIGHTWHITE_EX + centered = color + line.center(box_width - 2) + Style.RESET_ALL + print(Fore.MAGENTA + "║" + centered + Fore.MAGENTA + "║") + + print(Fore.MAGENTA + "╚" + "═" * (box_width - 2) + "╝" + Style.RESET_ALL) + time.sleep(1) + def run(self): - print(Fore.YELLOW + "Bye!") + self.shutdown_animation() return True # Signals to shell to exit