Pure Python implementation of FIGlet for creating ASCII art text from regular text using various fonts
—
Full-featured command line interface with extensive options for font selection, text formatting, color output, and font management. The CLI provides complete access to PyFiglet functionality from the terminal.
Main function that implements the complete command-line interface.
def main():
"""
Command-line interface entry point.
Returns:
int: Exit code (0 for success, 1 for error)
Processes command-line arguments and executes the requested operation:
- Text rendering with various options
- Font management operations
- Color output support
- Help and information display
"""# Simple text conversion
pyfiglet "Hello World"
# Using a specific font
pyfiglet -f big "Hello World"
# Multiple words as separate arguments
pyfiglet Hello World
# Text from stdin (interactive mode)
echo "Hello" | pyfiglet# List all available fonts
pyfiglet -l
# Get information about a specific font
pyfiglet -f standard -i
# Use different fonts
pyfiglet -f slant "Slanted Text"
pyfiglet -f big "Big Text"
pyfiglet -f shadow "Shadow Text"# Set output width
pyfiglet -w 120 "Wide Output"
# Text direction
pyfiglet -D left-to-right "LTR Text"
pyfiglet -D right-to-left "RTL Text"
# Justification
pyfiglet -j left "Left Aligned"
pyfiglet -j center "Centered"
pyfiglet -j right "Right Aligned"# Reverse (mirror horizontally)
pyfiglet -r "Reversed"
# Flip (mirror vertically)
pyfiglet -F "Flipped"
# Both transformations
pyfiglet -r -F "Reversed and Flipped"
# Normalize surrounding newlines
pyfiglet -n "Normalized"
# Strip surrounding newlines
pyfiglet -s "Stripped"# Foreground color only
pyfiglet -c red: "Red Text"
# Background color only
pyfiglet -c :blue "Blue Background"
# Both foreground and background
pyfiglet -c red:blue "Red on Blue"
# RGB colors
pyfiglet -c "255;100;50:0;0;255" "RGB Colors"
# List available colors
pyfiglet -c list# Install new fonts from file
pyfiglet -L path/to/font.flf
# Install fonts from ZIP archive
pyfiglet -L font-collection.zip
# Get font information
pyfiglet -f big -itext...: Text to convert (multiple arguments joined with spaces)-f FONT, --font FONT: Font to render with (default: standard)-l, --list_fonts: Show installed fonts list-i, --info_font: Show font information (use with -f)-L FILE, --load FILE: Load and install specified font file-w COLS, --width COLS: Set terminal width for wrapping/justification (default: 80)-D DIRECTION, --direction DIRECTION: Set text direction (auto, left-to-right, right-to-left)-j SIDE, --justify SIDE: Set justification (auto, left, center, right)-r, --reverse: Show mirror image of output text-F, --flip: Flip rendered output text over-n, --normalize-surrounding-newlines: Output has one empty line before and after-s, --strip-surrounding-newlines: Remove empty leading and trailing lines-c COLORS, --color COLORS: Print with colors in foreground:background format--version: Show version number and exit-h, --help: Show help message and exit# Basic text
pyfiglet "PyFiglet"
# With custom font and width
pyfiglet -f slant -w 100 "Custom Style"# Centered, colored text with transformations
pyfiglet -f big -j center -c "green:black" -w 120 "Fancy Title"
# Right-aligned, reversed text
pyfiglet -f shadow -j right -r "Mirrored"# List fonts and try a few
pyfiglet -l | head -5
pyfiglet -f banner "Banner Font"
pyfiglet -f bubble "Bubble Font"# Different color combinations
pyfiglet -c "red:" "Red Text"
pyfiglet -c ":yellow" "Yellow Background"
pyfiglet -c "white:blue" "White on Blue"
pyfiglet -c "255;0;128:0;255;128" "Pink on Green (RGB)"# Get details about fonts
pyfiglet -f standard -i
pyfiglet -f big -i# Install new fonts
pyfiglet -L ~/Downloads/new-font.flf
pyfiglet -L ~/Downloads/font-pack.zip
# Test newly installed font
pyfiglet -f new-font "Testing New Font"Install with Tessl CLI
npx tessl i tessl/pypi-pyfiglet