From 3b28d2328a7bfd37d4385d7c7d4445f820ddddcc Mon Sep 17 00:00:00 2001 From: aggarwalakshun Date: Fri, 12 Sep 2025 22:17:42 +0530 Subject: [PATCH] Add argument handling --- setup.py | 43 ++++++++++++++++++++++++++++++++++++++++++- 1 file changed, 42 insertions(+), 1 deletion(-) diff --git a/setup.py b/setup.py index 2895056..2908609 100644 --- a/setup.py +++ b/setup.py @@ -291,4 +291,45 @@ def install_other(): for other in selected_other: os.system(f"bash {dir}data/scripts/" + other + ".sh") -menu() \ No newline at end of file +def handle_arguments(): + arguments = sys.argv[1:] + if not arguments: + menu() + else: + if len(arguments) >= 2 and arguments[0] == "install": + if arguments[1] == "--system": + selected_items = arguments[2:] + if selected_items: + os.system(f"sudo dnf install -y {' '.join(selected_items)}") + else: + print("No packages specified for system install.") + elif arguments[1] == "--flatpak": + if which("flatpak") is None: + print("Flatpak is not installed. Install Flatpak? (y/n)") + choice = input() + if choice == "y": + os.system("sudo dnf install flatpak -y") + os.system("flatpak remote-add --if-not-exists flathub https://flathub.org/repo/flathub.flatpakrepo") + else: + print("Exiting...") + sys.exit(0) + selected_items = arguments[2:] + if selected_items: + os.system(f"flatpak install flathub {' '.join(selected_items)} -y") + else: + print("No packages specified for flatpak install.") + elif arguments[1] == "--drivers" and len(arguments) >= 3: + if arguments[2] == "nvidia": + os.system("sudo dnf install akmod-nvidia") + elif arguments[2] == "amd": + os.system("sudo dnf install mesa-dri-drivers") + elif arguments[2] == "intel": + os.system("sudo dnf install intel-media-driver") + else: + print("Unknown driver specified.") + else: + print("Invalid install option or missing arguments.") + else: + print("Unknown command or missing arguments.") + +handle_arguments()