Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
22 changes: 14 additions & 8 deletions docs/src/tty/index.md
Original file line number Diff line number Diff line change
@@ -1,21 +1,25 @@
# tty

[![Test](https://img.shields.io/github/actions/workflow/status/BlueLua/tty/test.yml?branch=main&label=test&style=flat-square)](https://github.com/BlueLua/tty/actions/workflows/test.yml)
[![LuaRocks](https://img.shields.io/luarocks/v/BlueLua/tty?color=blue&style=flat-square)](https://luarocks.org/modules/BlueLua/tty)
![Lua Versions](https://img.shields.io/badge/lua-5.1%20%7C%205.2%20%7C%205.3%20%7C%205.4%20%7C%205.5%20%7C%20LuaJIT-blue?style=flat-square)
![Platform](https://img.shields.io/badge/platform-linux%20%7C%20macos%20%7C%20windows-blue?style=flat-square)
[![License](https://img.shields.io/badge/license-MIT-blue?style=flat-square)](https://github.com/BlueLua/tty/blob/main/LICENSE)

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

Check out the [documentation] for guides and examples.

## ✨ 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.
- **TTY Verification**: Check if a Lua file handle, standard stream, or raw file
descriptor is interactive.
- **Window Dimension Query**: Retrieve the current terminal width (columns) and
height(rows) dynamically.
- **Multiple Lua Versions**: Compatible with LuaJIT, Lua 5.1, 5.2, 5.3, 5.4, and
5.5.
- **Cross-Platform**: Works consistently across Windows, macOS, and Linux.

## 📦 Installation

Expand All @@ -30,9 +34,11 @@ local tty = require "tty"

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

[documentation]: https://bluelua.github.io/tty
1 change: 1 addition & 0 deletions docs/src/tty/types.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
---
title: "Types"
description: "Types defined in the tty module."
pageClass: "types-page"
---

Types defined in the tty module.
Expand Down