mirror of
https://github.com/dylanaraps/pywal.git
synced 2025-02-08 14:30:25 +01:00
main: add -f flag to read colorscheme from file
This commit is contained in:
parent
a249f2083b
commit
76ec7f6cdc
@ -27,6 +27,9 @@ def get_args():
|
|||||||
arg.add_argument("-i", metavar="\"/path/to/img.jpg\"",
|
arg.add_argument("-i", metavar="\"/path/to/img.jpg\"",
|
||||||
help="Which image or directory to use.")
|
help="Which image or directory to use.")
|
||||||
|
|
||||||
|
arg.add_argument("-f", metavar="\"/path/to/colorscheme/file\"",
|
||||||
|
help="Which colorscheme file to use.")
|
||||||
|
|
||||||
arg.add_argument("-n", action="store_true",
|
arg.add_argument("-n", action="store_true",
|
||||||
help="Skip setting the wallpaper.")
|
help="Skip setting the wallpaper.")
|
||||||
|
|
||||||
@ -58,6 +61,11 @@ def process_args(args):
|
|||||||
" Refer to \"wal -h\" for more info.")
|
" Refer to \"wal -h\" for more info.")
|
||||||
exit(1)
|
exit(1)
|
||||||
|
|
||||||
|
if args.i and args.f:
|
||||||
|
print("error: conflicting arguments -i and -f.\n"
|
||||||
|
" Refer to \"wal -h\" for more info.")
|
||||||
|
exit(1)
|
||||||
|
|
||||||
# -q
|
# -q
|
||||||
if args.q:
|
if args.q:
|
||||||
sys.stdout = sys.stderr = open(os.devnull, "w")
|
sys.stdout = sys.stderr = open(os.devnull, "w")
|
||||||
@ -91,6 +99,12 @@ def process_args(args):
|
|||||||
set_colors.send_sequences(colors_plain, args.t)
|
set_colors.send_sequences(colors_plain, args.t)
|
||||||
export_colors.export_colors(colors_plain)
|
export_colors.export_colors(colors_plain)
|
||||||
|
|
||||||
|
# -f
|
||||||
|
elif args.f:
|
||||||
|
colors_plain = util.read_file(args.f)
|
||||||
|
set_colors.send_sequences(colors_plain, args.t)
|
||||||
|
export_colors.export_colors(colors_plain)
|
||||||
|
|
||||||
# -o
|
# -o
|
||||||
if args.o:
|
if args.o:
|
||||||
util.disown(args.o)
|
util.disown(args.o)
|
||||||
|
Loading…
Reference in New Issue
Block a user