xrepl/term
A modern terminal control library for LFE
Features
- ANSI Colours & Styles - Rich text formatting with composable DSL
- Inline Graphics - Display images via iTerm2, Kitty, and Sixel protocols
- Hyperlinks - Clickable terminal links (OSC 8)
- Notifications - Desktop notifications from terminal
- UI Components - Tables, progress bars, tree views
- Auto-detection - Automatically detect terminal capabilities
- Zero Dependencies - Pure Erlang/LFE implementation
Installation
Add to your rebar.config:
{deps, [
{xrepl_term, {git, "https://github.com/xrepl/term.git", {branch, "main"}}}
]}.Quick Start
;; Include colour macros
(include-lib "xrepl_term/include/colours.lfe")
;; Basic styling
(io:format "~s~n" (list (red! "Error: " (bold! "File not found"))))
;; Threading macro style
(clj:-> "Important Message"
(bold!)
(fg! 'cyan)
(underline!)
(list)
(io:format "~s~n"))
;; Display image
(xrepl-term-graphics:render-file "chart.png" #m(width "80%"))
;; Create table
(xrepl-term-ui:table
#m(headers '("Name" "Age" "City")
rows '(("Alice" 30 "NYC")
("Bob" 25 "SF"))))Documentation
See examples/ for more usage patterns.
License
Apache-2.0