which-terminal

Crates.iowhich-terminal
lib.rswhich-terminal
version0.1.0
created_at2025-11-07 14:39:53.710197+00
updated_at2025-11-07 14:39:53.710197+00
descriptionCross-platform terminal detection library for Rust
homepagehttps://github.com/ahaoboy/which-terminal
repositoryhttps://github.com/ahaoboy/which-terminal
max_upload_size
id1921661
size19,789
阿豪 (ahaoboy)

documentation

README

which-terminal

A cross-platform Rust library for detecting the current terminal emulator and its version.

Crates.io Documentation License: MIT

Features

  • 🚀 Fast detection - Environment-based detection with minimal overhead
  • 🌍 Cross-platform - Supports Windows, macOS, Linux, and Android
  • 📦 Zero dependencies - No external dependencies for core functionality
  • 🔍 20+ terminals - Detects popular terminal emulators across all platforms
  • 📝 Version info - Retrieves version information when available
  • 🦀 Pure Rust - Written entirely in Rust with idiomatic APIs

Supported Terminals

Windows

  • Windows Terminal
  • Command Prompt (cmd.exe)
  • PowerShell
  • ConEmu
  • Cmder

macOS

  • Terminal.app (Apple Terminal)
  • iTerm2

Linux

  • GNOME Terminal
  • Konsole
  • XTerm
  • Rxvt
  • Terminator
  • Tilix

Cross-platform

  • Alacritty
  • Kitty
  • Hyper
  • WezTerm
  • Tabby

Android

  • Termux

Installation

Add this to your Cargo.toml:

[dependencies]
which-terminal = "0.1"

Quick Start

fn main() {
    println!("{:#?}", which_terminal::which_terminal());
}

Contributing

Contributions are welcome! Please feel free to submit a Pull Request.

Adding New Terminals

To add support for a new terminal:

  1. Add the terminal variant to the Terminal enum in src/types.rs
  2. Add detection logic to the appropriate platform module
  3. Add version extraction if available
  4. Update documentation and tests

License

This project is licensed under the MIT License - see the LICENSE file for details.

Acknowledgments

  • Inspired by various terminal detection libraries in other languages
  • Thanks to all terminal emulator developers for providing detection mechanisms

Related Projects

  • term - Terminal formatting library
  • console - Terminal and console abstraction
  • crossterm - Cross-platform terminal manipulation
Commit count: 0

cargo fmt