Add recursive argument to cli

This commit is contained in:
Lorenz Leitner 2019-03-15 10:06:04 +01:00
parent 3a95122157
commit 31f23088d7
2 changed files with 7 additions and 2 deletions

View File

@ -53,6 +53,11 @@ def get_args():
"flag is used: Go through the images in order " "flag is used: Go through the images in order "
"instead of shuffled.") "instead of shuffled.")
arg.add_argument("--recursive", action="store_true",
help="When pywal is given a directory as input and this "
"flag is used: Search for images recursively in "
"subdirectories instead of the root only.")
arg.add_argument("--saturate", metavar="0.0-1.0", arg.add_argument("--saturate", metavar="0.0-1.0",
help="Set the color saturation.") help="Set the color saturation.")
@ -159,7 +164,8 @@ def parse_args(parser):
util.Color.alpha_num = args.a util.Color.alpha_num = args.a
if args.i: if args.i:
image_file = image.get(args.i, iterative=args.iterative) image_file = image.get(args.i, iterative=args.iterative,
recursive=args.recursive)
colors_plain = colors.get(image_file, args.l, args.backend, colors_plain = colors.get(image_file, args.l, args.backend,
sat=args.saturate) sat=args.saturate)

View File

@ -98,7 +98,6 @@ def get_next_image(img_dir, recursive):
def get(img, cache_dir=CACHE_DIR, iterative=False, recursive=False): def get(img, cache_dir=CACHE_DIR, iterative=False, recursive=False):
"""Validate image input.""" """Validate image input."""
recursive = True # TODO: Remove
if os.path.isfile(img): if os.path.isfile(img):
wal_img = img wal_img = img