Skip to content

Instantly share code, notes, and snippets.

@zoeisnowooze
Last active June 14, 2022 02:10
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save zoeisnowooze/ce40b419e0cd561d6d407d1af1d9d48f to your computer and use it in GitHub Desktop.
Save zoeisnowooze/ce40b419e0cd561d6d407d1af1d9d48f to your computer and use it in GitHub Desktop.
Loooooong teeeeeext
import argparse
import shutil
import subprocess
def main():
parser = argparse.ArgumentParser(description="Multiplies the vowels.")
parser.add_argument("string", metavar="STRING", type=str, help="a string")
parser.add_argument("n", metavar="N", type=int, help="an integer")
parser.add_argument(
"--toilet", action="store_true", help="Display large characters"
)
parser.add_argument("--cowsay", action="store_true", help="Cow says the string")
parser.add_argument("--lolcat", action="store_true", help="Display as a rainbow")
args = parser.parse_args()
ascii_vowels = "aeiouAEIOU"
table = str.maketrans({v: v * args.n for v in ascii_vowels}) # 🏳️‍⚧️
longtext = args.string.translate(table)
pipe = []
if args.toilet and shutil.which("toilet"):
pipe.append("toilet")
if args.cowsay and shutil.which("cowsay"):
pipe.append("cowsay -n")
if args.lolcat and shutil.which("lolcat"):
pipe.append("lolcat")
if pipe:
subprocess.run(" | ".join(pipe), input=longtext + "\n", text=True, shell=True)
else:
print(longtext)
if __name__ == "__main__":
main()
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment