summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDylan Araps <dylan.araps@gmail.com>2018-03-15 17:52:33 +1100
committerDylan Araps <dylan.araps@gmail.com>2018-03-15 17:52:33 +1100
commit98418fc3d0c79daa0e74a384b15ed60dcf19734b (patch)
tree6626848ed0a9f8a874798fc6295934b43f62524c
parent3569d10312ecc7d46de5e4f8e90d217f7d3dfdb3 (diff)
themes: -f with no args lists themes.
-rw-r--r--pywal/__main__.py16
1 files changed, 13 insertions, 3 deletions
diff --git a/pywal/__main__.py b/pywal/__main__.py
index 7c0bf06..f9bd2a2 100644
--- a/pywal/__main__.py
+++ b/pywal/__main__.py
@@ -14,7 +14,7 @@ import os
import shutil
import sys
-from .settings import __version__, CACHE_DIR
+from .settings import __version__, CACHE_DIR, MODULE_DIR
from . import colors
from . import export
from . import image
@@ -42,8 +42,10 @@ def get_args(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("-f", metavar="/path/to/colorscheme/file or theme_name",
+ help="Which colorscheme file to use. \
+ Use 'wal -f' to list available builtin themes.",
+ const="list_themes", nargs="?")
arg.add_argument("-g", action="store_true",
help="Generate an oomox theme.")
@@ -122,6 +124,14 @@ def process_args(args):
image_file = image.get(args.i)
colors_plain = colors.get(image_file, light=args.l)
+ if args.f == "list_themes":
+ themes = os.listdir(os.path.join(MODULE_DIR, "colorschemes"))
+
+ print("Themes:",
+ ", ".join([theme.replace(".json", "") for theme in themes]))
+
+ sys.exit(0)
+
if args.f:
colors_plain = colors.file(args.f)