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, 19 insertions, 4 deletions
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]