diff options
| author | Chandler J <cjustice2000@gmail.com> | 2024-04-12 20:54:20 -0600 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2024-04-12 20:54:20 -0600 |
| commit | c5937854ff01ba29da48b7b0560ef27faad00d53 (patch) | |
| tree | e8fc9dc0bb690cc1976a47fe1166f4bafcafcb40 /src/get_args.py | |
| parent | 2564189a769a5bd3de63086bb62dc3532d1b07b9 (diff) | |
| parent | 8a1903bb16d9e04795c33f3eb226486d06e8a642 (diff) | |
Merge pull request #2 from chandlerj/saves
major changes: save states & refactoring
Diffstat (limited to 'src/get_args.py')
| -rw-r--r-- | src/get_args.py | 23 |
1 files changed, 9 insertions, 14 deletions
diff --git a/src/get_args.py b/src/get_args.py index 45f41cf..f878e77 100644 --- a/src/get_args.py +++ b/src/get_args.py @@ -11,21 +11,16 @@ def get_args(args, walls_dir) -> tuple: initialize = False reconfigure = False - color_save = None + + theme = None + VALID_ARGS = ['-r', '-p', '--initialize', '--reconfigure'] - # load saved palette if '-p' in args: index = args.index('-p') - try: - if os.path.isfile(args[index + 1]): - color_save = manage_saves.load_color_palette(args[index + 1]) - else: - print(f'[bold red] Error!! invalid argument {args[index + 1]}. -p should be followed by a color palette save') - exit(2) - except IndexError: - print('[bold red]Error!! -p should be followed by location of a color palette save') - usage(args) - exit(2) + isFile = os.path.isfile(args[index + 1]) + if isFile == True: + print("reached") + theme = manage_saves.load_theme(args[index + 1]) if '-r' in args: img_path = user_interface.pickRandomWallpaper(walls_dir) @@ -34,13 +29,13 @@ def get_args(args, walls_dir) -> tuple: 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) + exit(2) if '--initialize' in args: initialize = True if '--reconfigure' in args: reconfigure = True - return img_path, initialize, reconfigure, color_save + return img_path, initialize, reconfigure, theme def usage(args) -> None: |
