CtrlK
BlogDocsLog inGet started
Tessl Logo

tessl/pypi-pyfiglet

Pure Python implementation of FIGlet for creating ASCII art text from regular text using various fonts

Pending
Overview
Eval results
Files

cli.mddocs/

Command Line Interface

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.

Capabilities

Command Entry Point

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
    """

Usage Patterns

Basic Text Rendering

# 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

Font Options

# 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"

Text Formatting Options

# 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"

Text Transformations

# 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"

Color Output

# 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

Font Management

# 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 -i

Command Line Options

Text Input Options

  • text...: Text to convert (multiple arguments joined with spaces)

Font Options

  • -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

Layout Options

  • -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)

Transformation Options

  • -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

Color Options

  • -c COLORS, --color COLORS: Print with colors in foreground:background format

Information Options

  • --version: Show version number and exit
  • -h, --help: Show help message and exit

Examples

Simple Usage

# Basic text
pyfiglet "PyFiglet"

# With custom font and width
pyfiglet -f slant -w 100 "Custom Style"

Complex Formatting

# 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"

Font Discovery

# List fonts and try a few
pyfiglet -l | head -5
pyfiglet -f banner "Banner Font"
pyfiglet -f bubble "Bubble Font"

Color Examples

# 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)"

Font Information

# Get details about fonts
pyfiglet -f standard -i
pyfiglet -f big -i

Installation and Management

# 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"

Exit Codes

  • 0: Success
  • 1: Error (font not found, invalid arguments, etc.)

Input Handling

  • Arguments: Text provided as command-line arguments
  • Interactive: If no text arguments provided, shows help
  • Encoding: Supports UTF-8 text input
  • Stdin: Can accept piped input in interactive shells

Output Format

  • Stdout: ASCII art output with optional ANSI color codes
  • Stderr: Error messages and informational output
  • Binary mode: Switches stdout to binary mode for proper color handling

Platform Compatibility

  • Unix/Linux: Full feature support including colors
  • Windows: Full support with modern terminals, basic support with legacy Command Prompt
  • Color support: Automatically detected based on terminal capabilities

Install with Tessl CLI

npx tessl i tessl/pypi-pyfiglet

docs

advanced-rendering.md

cli.md

color-support.md

font-management.md

index.md

string-manipulation.md

text-rendering.md

tile.json