summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDylan Araps <dylanaraps@users.noreply.github.com>2017-06-28 22:53:41 +1000
committerGitHub <noreply@github.com>2017-06-28 22:53:41 +1000
commit559ded2dadbeae9aec30ef925c34e8606bd1e4a0 (patch)
tree8c5b432785324fa18fa80d1cb4f877c1fa10da16
parenta249f2083b5c88902eb656ecea2ba3e05962b74b (diff)
parent76ec7f6cdc1df7a36acae2aa226c83cdc3e5d966 (diff)
Merge pull request #14 from opatut/load-colorscheme-from-file
Add -f flag to read colorscheme from file
-rwxr-xr-xpywal/__main__.py14
1 files changed, 14 insertions, 0 deletions
diff --git a/pywal/__main__.py b/pywal/__main__.py
index e31fb5d..f9341a5 100755
--- a/pywal/__main__.py
+++ b/pywal/__main__.py
@@ -27,6 +27,9 @@ def get_args():
arg.add_argument("-i", metavar="\"/path/to/img.jpg\"",
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",
help="Skip setting the wallpaper.")
@@ -58,6 +61,11 @@ def process_args(args):
" Refer to \"wal -h\" for more info.")
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
if args.q:
sys.stdout = sys.stderr = open(os.devnull, "w")
@@ -91,6 +99,12 @@ def process_args(args):
set_colors.send_sequences(colors_plain, args.t)
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
if args.o:
util.disown(args.o)