summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDylan Araps <dylan.araps@gmail.com>2017-06-20 14:43:41 +1000
committerDylan Araps <dylan.araps@gmail.com>2017-06-20 14:43:41 +1000
commitd4c181fa477f6270067e313dff7e1dc339cda800 (patch)
treeb9dcedb4b761aea66d99158c37f7fd3f11ef9942
parent137d986742a8b2381f320180a9fc0dcc4c545614 (diff)
General: Cleanup
-rwxr-xr-xwal13
1 files changed, 8 insertions, 5 deletions
diff --git a/wal b/wal
index 164dc90..df99d7f 100755
--- a/wal
+++ b/wal
@@ -19,7 +19,7 @@ __version__ = "0.1"
# Internal variables.
COLOR_COUNT = 16
-CACHE_DIR = pathlib.Path("%s%s" % (os.path.expanduser("~"), "/.cache/wal/"))
+CACHE_DIR = pathlib.Path.home() / ".cache/wal/"
class ColorFormats(object): # pylint: disable=too-few-public-methods
@@ -78,6 +78,7 @@ def process_args(args):
# -c
if args.c:
shutil.rmtree(CACHE_DIR / "schemes")
+ create_cache_dir()
# -r
if args.r:
@@ -86,8 +87,6 @@ def process_args(args):
# -i
if args.i:
image = str(get_image(args.i))
-
- # Get the colors.
colors = get_colors(image)
# Set the wallpaper.
@@ -465,13 +464,17 @@ def save_file(colors, export_file):
file.write(colors)
+def create_cache_dir():
+ """Alias to create the cache dir."""
+ pathlib.Path(CACHE_DIR / "schemes").mkdir(parents=True, exist_ok=True)
+
+
# }}}
def main():
"""Main script function."""
- # Create colorscheme dir.
- pathlib.Path(CACHE_DIR / "schemes").mkdir(parents=True, exist_ok=True)
+ create_cache_dir()
# Get the args.
args = get_args()