From c4bf3bed834d6055e5d3355bcf60fa4d4786e6af Mon Sep 17 00:00:00 2001 From: "Nicholas J. Grosso" Date: Mon, 21 Mar 2022 06:25:25 -0400 Subject: [PATCH 1/2] done --- protonup/api.py | 15 +++++++++++---- protonup/cli.py | 3 ++- 2 files changed, 13 insertions(+), 5 deletions(-) diff --git a/protonup/api.py b/protonup/api.py index 8856611..34492f4 100755 --- a/protonup/api.py +++ b/protonup/api.py @@ -86,7 +86,10 @@ def installed_versions() -> list: return versions_found -def get_proton(version=None, yes=True, dl_only=False, output=None) -> None: +def get_proton(version=None, yes=True, dl_only=False, output=None, quiet=True) -> None: + show = False + if yes or quiet: + show = True """Download and (optionally) install Proton""" installdir = install_directory() data = fetch_data(tag=version) @@ -117,12 +120,16 @@ def get_proton(version=None, yes=True, dl_only=False, output=None) -> None: return # Confirmation - if not yes: + if not yes and not quiet: print(f"Ready to download Proton-{data['version']}", f"\nSize : {readable_size(data['size'])}", f"\nPublished : {data['date']}") if input("Continue? (Y/n): ") not in ['y', 'Y', '']: return + elif quiet: + print(f"Ready to download Proton-{data['version']}", + f"\nSize : {readable_size(data['size'])}", + f"\nPublished : {data['date']}") # Prepare Destination destination = output if output else (os.getcwd() if dl_only else TEMP_DIR) @@ -132,8 +139,8 @@ def get_proton(version=None, yes=True, dl_only=False, output=None) -> None: destination = os.path.expanduser(destination) # Download - if not download(url=data['download'], destination=destination, show_progress=not yes): - if not yes: + if not download(url=data['download'], destination=destination, show_progress=not show): + if not show: print("[ERROR] Download failed") return diff --git a/protonup/cli.py b/protonup/cli.py index aa4697a..226bb3a 100644 --- a/protonup/cli.py +++ b/protonup/cli.py @@ -17,6 +17,7 @@ def parse_arguments(): help='set download directory') parser.add_argument('-d', '--dir', type=str, default=None, help='set installation directory') parser.add_argument('-y', '--yes', action='store_true', help='disable prompts and logs') + parser.add_argument('-q', '--quiet', action='store_true', help='disable prompts but show logs') parser.add_argument('--download', action='store_true', help='download only') parser.add_argument('--releases', action='store_true', help='list available versions') return parser.parse_args() @@ -31,7 +32,7 @@ def main(): if args.tag or not (args.remove or args.list or args.dir or args.releases): get_proton(version=args.tag, yes=args.yes, dl_only=args.download, - output=args.output) + output=args.output, quiet=args.quiet) if args.remove: if args.yes or input(f"Confirm remove {args.remove}? (Y/n): ") not in ['y', 'Y', '']: return From fa1668d54b3da965121dedc3016e15bce83dd5fb Mon Sep 17 00:00:00 2001 From: "Nicholas J. Grosso" Date: Mon, 21 Mar 2022 12:39:26 -0400 Subject: [PATCH 2/2] Forgot to swap y and q --- protonup/api.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/protonup/api.py b/protonup/api.py index 34492f4..c269c09 100755 --- a/protonup/api.py +++ b/protonup/api.py @@ -126,7 +126,7 @@ def get_proton(version=None, yes=True, dl_only=False, output=None, quiet=True) - f"\nPublished : {data['date']}") if input("Continue? (Y/n): ") not in ['y', 'Y', '']: return - elif quiet: + elif yes: print(f"Ready to download Proton-{data['version']}", f"\nSize : {readable_size(data['size'])}", f"\nPublished : {data['date']}")