Skip to main content

Module utils

Module utils 

Source
Expand description

Utilities: logging, clipboard, file operations, syntax highlighting

Constants§

SUPPORTED_LANGUAGES
Supported languages: (display name, aliases for CLI)

Functions§

copy_to_clipboard
Copy text to system clipboard (macOS/Windows/Linux via arboard).
from_extension
Suggest language from file extension (e.g. “.rs” -> “rust”).
from_prompt
Suggest language from prompt (simple keyword heuristic).
highlight_to_ansi
Highlight code to ANSI-colored string for terminal. Returns original code if no syntax found.
is_supported
Return true if lang is a supported language or alias.
normalize
Normalize language (alias -> canonical name).
read_file
Read entire file as string.
setup_logging
Initialize logging from verbosity and debug flags. Call once at startup after parsing args.
write_file
Write content to a file. Creates parent dirs if needed.