From 0f6fd394f39406b76e8f18fe4c2ddb791194f978 Mon Sep 17 00:00:00 2001 From: Chandler J Date: Mon, 18 Mar 2024 13:14:40 -0600 Subject: began implementating save states for color palettes and MOAR POLISH --- src/get_args.py | 23 +++++++++++++++++++---- 1 file changed, 19 insertions(+), 4 deletions(-) (limited to 'src/get_args.py') diff --git a/src/get_args.py b/src/get_args.py index ade7740..ebdf464 100644 --- a/src/get_args.py +++ b/src/get_args.py @@ -1,24 +1,39 @@ import user_interface +import manage_saves import os +from rich import print def get_args(args, walls_dir) -> tuple: # arguments that can be passed into program initialize = False reconfigure = False - + color_save = None + VALID_ARGS = ['-r', '-p', '--initialize', '--reconfigure'] + if '-p' in args: + index = args.index('-p') + if os.path.isfile(args[index + 1]): + color_save = manage_saves.load_color_palette(args[index + 1]) + else: + print('invalid arguments. -p should be followed by a color palette save') + exit(2) + if '-r' in args: img_path = user_interface.pickRandomWallpaper(walls_dir) else: img_path = f"{os.getcwd()}/{args[1]}" + if not os.path.exists(img_path) and\ + args[1] not in VALID_ARGS: + print(f'[bold red]ERROR: invalid image path {os.getcwd()}/{args[1]}') + exit(3) + if '--initialize' in args: initialize = True if '--reconfigure' in args: reconfigure = True - return img_path, initialize, reconfigure + return img_path, initialize, reconfigure, color_save def usage(args) -> None: - print(f""" -Instant Rice - An automatic theming utilitiy + print(f"""Instant Rice - An automatic theming utilitiy Usage: python3 {args[0]} [Relative Image Path] [-r, --initialize, --reconfigure, --dmenu, --nolock] -- cgit v1.2.3