Untitled

 avatar
unknown
python
a year ago
629 B
8
Indexable
from pyfiglet import Figlet
from random import choice
import sys

figlet = Figlet()

if len(sys.argv) == 1:
    random_font = Figlet(choice(figlet.getFonts()))
    text = input("Input: ")
    print("Output:\n", random_font.renderText(text))

elif len(sys.argv) == 3:
    if sys.argv[1] in ['-f', '--font']:
        try:
            font = Figlet(font=sys.argv[2])
            text = input("Input: ")
            print("Output:\n", figlet.renderText(text))
        except Exception as e:
            sys.exit("invalid usage.")
    else:
        sys.exit("Invalid usage")
else:
    sys.exit("Invalid usage")
Editor is loading...
Leave a Comment