diff options
author | Hugo Hörnquist <hugo@lysator.liu.se> | 2023-07-12 23:14:23 +0200 |
---|---|---|
committer | Hugo Hörnquist <hugo@lysator.liu.se> | 2023-07-12 23:14:23 +0200 |
commit | f333cae22e1d19119b1aa9ee9d30daa21243d1d8 (patch) | |
tree | 28cbef38210abb01284a54041250342f556bd8e9 /rainbow_parenthesis/__main__.py | |
parent | Remove black from the pool of colors. (diff) | |
download | rainbow-parenthesis-f333cae22e1d19119b1aa9ee9d30daa21243d1d8.tar.gz rainbow-parenthesis-f333cae22e1d19119b1aa9ee9d30daa21243d1d8.tar.xz |
Move project to a proper module layout.
Diffstat (limited to '')
-rw-r--r-- | rainbow_parenthesis/__main__.py | 23 |
1 files changed, 23 insertions, 0 deletions
diff --git a/rainbow_parenthesis/__main__.py b/rainbow_parenthesis/__main__.py new file mode 100644 index 0000000..251731a --- /dev/null +++ b/rainbow_parenthesis/__main__.py @@ -0,0 +1,23 @@ +""" +Entry point for rainbow parenthesis. + +Reads a string from stdin, and outputs it to stdout with all +parenthesis prettily colored. +""" + +from . import colorize, Colored +from . import term +import argparse + +parser = argparse.ArgumentParser(prog='rainbow') +parser.add_argument('input', type=argparse.FileType('r'), + nargs='?', default='-') +args = parser.parse_args() + + +for item in colorize(args.input): + match item: + case Colored(): + print(term.colorize(item), end='') + case s: + print(s, end='') |