Skip to content

BlueLua/tty

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

26 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

tty

LuaRocks ci Status Lua Versions Platform License

tty provides lightweight, cross-platform C-backed Lua bindings for terminal detection and terminal size inspection.

Read the documentation to get started.

✨ Features

  • TTY Verification: Check if a Lua file handle (like io.stdout, io.stdin), standard stream, or raw file descriptor is interactive.
  • Window Dimension Query: Retrieve the current width (columns) and height (rows) of the active terminal dynamically.
  • Multiple Lua Versions: Compatible with LuaJIT, Lua 5.1, 5.2, 5.3, 5.4, and 5.5.

📦 Installation

luarocks install tty

🚀 Usage

local tty = require "tty"

-- Check if standard output is a TTY
if tty.isatty(io.stdout) then
  local rows, cols = tty.size()
  print(string.format("Terminal size: %dx%d", cols, rows))
else
  print("Output is redirected")
end

About

Small cross-platform Lua bindings for terminal inspection.

Topics

Resources

License

Code of conduct

Contributing

Security policy

Stars

Watchers

Forks

Sponsor this project

Contributors