Args: Added -q

This commit is contained in:
Dylan Araps 2017-06-19 19:24:28 +10:00
parent b2ae26b4fb
commit 57fed5b29c

28
wal.py
View File

@ -4,13 +4,14 @@ wal - Generate and change colorschemes on the fly.
Created by Dylan Araps Created by Dylan Araps
""" """
import argparse import argparse
import re
import random
import glob import glob
import shutil
import subprocess
import os import os
import pathlib import pathlib
import random
import re
import shutil
import subprocess
import sys
# wal files. # wal files.
@ -34,16 +35,9 @@ def get_args():
arg = argparse.ArgumentParser(description=description) arg = argparse.ArgumentParser(description=description)
# Add the args. # Add the args.
# arg.add_argument('-a', metavar='0-100', type=int,
# help='Set terminal background transparency. \
# *Only works in URxvt*')
arg.add_argument('-c', action='store_true', arg.add_argument('-c', action='store_true',
help='Delete all cached colorschemes.') help='Delete all cached colorschemes.')
# arg.add_argument('-f', metavar='"/path/to/colors"',
# help='Load colors directly from a colorscheme file.')
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.')
@ -53,8 +47,8 @@ def get_args():
arg.add_argument('-o', metavar='"script_name"', arg.add_argument('-o', metavar='"script_name"',
help='External script to run after "wal".') help='External script to run after "wal".')
# arg.add_argument('-q', action='store_true', arg.add_argument('-q', action='store_true',
# help='Quiet mode, don\'t print anything.') help='Quiet mode, don\'t print anything.')
arg.add_argument('-r', action='store_true', arg.add_argument('-r', action='store_true',
help='Reload current colorscheme.') help='Reload current colorscheme.')
@ -63,9 +57,6 @@ def get_args():
help='Fix artifacts in VTE Terminals. \ help='Fix artifacts in VTE Terminals. \
(Termite, xfce4-terminal)') (Termite, xfce4-terminal)')
# arg.add_argument('-x', action='store_true',
# help='Use extended 16-color palette.')
return arg.parse_args() return arg.parse_args()
@ -382,6 +373,11 @@ def main():
# Get the args. # Get the args.
args = get_args() args = get_args()
# -q
if args.q:
sys.stdout = open('/dev/null', 'w')
sys.stderr = open('/dev/null', 'w')
# -c # -c
if args.c: if args.c:
shutil.rmtree(SCHEME_DIR) shutil.rmtree(SCHEME_DIR)