diff --git a/__modules__/dank.winget.py b/__modules__/dank.winget.py index e4901c3..799c0d0 100644 --- a/__modules__/dank.winget.py +++ b/__modules__/dank.winget.py @@ -81,14 +81,20 @@ def main(): if cmd.lower().startswith('search '): cmd = subprocess.run(['winget', 'search', '--accept-source-agreements', cmd[7:]], stdout=subprocess.PIPE, stderr=subprocess.PIPE, check=False) if cmd.returncode == 0: - handle_response(cmd, results, 'search') + if len(cmd) > 0: + handle_response(cmd, results, 'search') + else: + print(clr("\n [KNOWN ERROR]: Please report this issue on GitHub / Discord Support Ticket to help fix it!",2)) else: print(clr(f"\n [ERROR]: {cmd.stdout.decode('utf-8')}",2)) elif cmd.lower().startswith('installed'): cmd = subprocess.run(['winget', 'list', '--accept-source-agreements'], stdout=subprocess.PIPE, stderr=subprocess.PIPE, check=False) if cmd.returncode == 0: - handle_response(cmd, results, 'installed') + if len(cmd) > 0: + handle_response(cmd, results, 'installed') + else: + print(clr("\n [KNOWN ERROR]: Please report this issue on GitHub / Discord Support Ticket to help fix it!",2)) else: print(clr(f"\n [ERROR]: {cmd.stdout.decode('utf-8')}",2)) @@ -96,15 +102,18 @@ def main(): choice = cmd.lower() cmd = subprocess.run(['winget', 'upgrade', '--accept-source-agreements'], stdout=subprocess.PIPE, stderr=subprocess.PIPE, check=False) if cmd.returncode == 0: - if not choice.startswith('update-all'): - handle_response(cmd, results, 'updates') + if len(cmd) > 0: + if not choice.startswith('update-all'): + handle_response(cmd, results, 'updates') + else: + handle_response(cmd, results, 'update-all') + max = len(results) - 1 + for index in range(1, max + 1): + print(clr(f"\n - [{index}/{max}] Updating {results[index]['name']}...\n")) + os.system(f"winget upgrade --interactive --id {results[index]['id']}") + print() else: - handle_response(cmd, results, 'update-all') - max = len(results) - 1 - for index in range(1, max + 1): - print(clr(f"\n - [{index}/{max}] Updating {results[index]['name']}...\n")) - os.system(f"winget upgrade --interactive --id {results[index]['id']}") - print() + print(clr("\n [KNOWN ERROR]: Please report this issue on GitHub / Discord Support Ticket to help fix it!",2)) else: print(clr(f"\n [ERROR]: {cmd.stdout.decode('utf-8')}",2))