From e3c35285f23f18601940faebead7d5975b7563f0 Mon Sep 17 00:00:00 2001 From: LunaChocken Date: Sun, 8 Jun 2025 19:30:10 +0100 Subject: [PATCH] - Add all command to display All games - Remove printing all games immediately --- main.py | 19 ++++++++++++------- src/prompt_helper.py | 3 +++ 2 files changed, 15 insertions(+), 7 deletions(-) diff --git a/main.py b/main.py index 5fc48b5..d9ebc11 100644 --- a/main.py +++ b/main.py @@ -21,11 +21,11 @@ class SteamGamePathTool: self.steam_library_locations = vd.find_extra_locations(self.steam_vdf) games = vd.fetchall_vdfs(self.steam_vdf) - games = self.sort_games(games) + self.games = self.sort_games(games) - console = Console() - game_rend = [Panel(self.get_game_content(game), expand=True) for game in games] - console.print(Columns(game_rend)) + # console = Console() + # + # console.print(Columns(game_rend)) for library in self.steam_library_locations: print(f"[+] Found Steam library at: {library}") @@ -40,11 +40,16 @@ class SteamGamePathTool: break def prompt_user(self): - game = self.prompter.prompt_game(text="Input (game name | appid | q/quit): ") + game = self.prompter.prompt_game(text="Input (game name | appid | all | q/quit): ") if game is None: return - console = Console() - console.print(Panel(self.get_game_content(game), expand=True)) + elif game == 'fetch_all_games': + console = Console() + game_rend = [Panel(self.get_game_content(game), expand=True) for game in self.games] + console.print(Columns(game_rend)) + else: + console = Console() + console.print(Panel(self.get_game_content(game), expand=True)) def sort_games(self, games): diff --git a/src/prompt_helper.py b/src/prompt_helper.py index 8daf62b..eea546d 100644 --- a/src/prompt_helper.py +++ b/src/prompt_helper.py @@ -6,6 +6,7 @@ def generate_completer(game_list): g_list = [x['name'] for x in game_list] + [x['appid'] for x in game_list] g_list.append("q") g_list.append("quit") + g_list.append("all") return FuzzyCompleter(WordCompleter(g_list)) class PromptHelper: @@ -33,6 +34,8 @@ class PromptHelper: try: if response == "": return None + elif response == "all": + return "fetch_all_games" elif response == "q" or response == "quit": print("Goodbye!") sys.exit(0)