summaryrefslogtreecommitdiff
path: root/src/get_args.py
diff options
context:
space:
mode:
Diffstat (limited to 'src/get_args.py')
-rw-r--r--src/get_args.py23
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: