Last active
January 10, 2018 01:38
-
-
Save jedsmith/1422c5e677c4a1feb7022a4c1496b275 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env python3 | |
import argparse | |
import string | |
TABLE = {letter: f':parrot-{letter}:' for letter in string.ascii_lowercase} | |
arguments = argparse.ArgumentParser(description="Party parrot text-o-matic.") | |
arguments.add_argument('words', metavar='TEXT', type=str, nargs='+', | |
help="text to make badass") | |
arguments.add_argument('--weak', dest='separator', action='store_const', | |
const=' ', default=':parrot:', help="preserve spaces in input, weak") | |
options = arguments.parse_args() | |
final = len(options.words) - 1 | |
for i, word in enumerate(options.words): | |
separator = "" if i == final else options.separator | |
print("".join(TABLE.get(let, let) for let in word.lower()), end=separator) | |
print() |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment