- commit
- e255b8439a45f2e9a7f152c639c9cbc8b1a97da1
- parent
- bd7b6bba464c0a92a4507fb327f8a461f6b46ef8
- Author
- Tobias Bengfort <tobias.bengfort@posteo.de>
- Date
- 2019-11-15 08:05
add argparse
Diffstat
| M | wal/__main__.py | 22 | ++++++++++++++++++++-- |
1 files changed, 20 insertions, 2 deletions
diff --git a/wal/__main__.py b/wal/__main__.py
@@ -1,4 +1,5 @@ 1 1 import sys -1 2 import argparse 2 3 3 4 from . import image 4 5 from . import scheme @@ -10,10 +11,27 @@ gruvbox = ['#3c3836', '#cc241d', '#98971a', '#d79921', '#458588', '#b16286', '#6 10 11 tango = ['#555753', '#ef2929', '#8ae234', '#fce94f', '#739fcf', '#ad7fa8', '#34e2e2'] 11 12 12 13 -1 14 def parse_args(): -1 15 parser = argparse.ArgumentParser() -1 16 parser.add_argument('--image', '-i') -1 17 parser.add_argument('-n', type=int, default=8) -1 18 parser.add_argument('colors', nargs='*') -1 19 return parser.parse_args() -1 20 -1 21 13 22 if __name__ == '__main__':14 -1 colors = list(image.extract_colors(sys.argv[1], 9))15 -1 # colors = solarized-1 23 args = parse_args() -1 24 -1 25 colors = [] -1 26 if args.image: -1 27 colors += list(image.extract_colors(args.image, args.n)) -1 28 colors += args.colors -1 29 -1 30 if len(colors) < 6: -1 31 sys.exit('Need at least 6 colors') -1 32 16 33 scheme = scheme.colors2scheme(colors) -1 34 17 35 print(';'.join(scheme)) 18 36 term.palette() 19 37 term.apply(scheme)