Raxol.System.TerminalPlatform (Raxol v0.5.0)

View Source

Terminal-specific platform features and compatibility checks.

This module provides detailed information about terminal capabilities, feature support, and compatibility across different platforms and terminal emulators.

Summary

Functions

Returns the list of all supported terminal features.

Returns detailed information about the current terminal's capabilities.

Checks if a specific terminal feature is supported.

Types

terminal_feature()

@type terminal_feature() ::
  :true_color
  | :unicode
  | :mouse
  | :clipboard
  | :bracketed_paste
  | :focus
  | :title

Functions

get_supported_features()

@spec get_supported_features() :: [terminal_feature()]

Returns the list of all supported terminal features.

Returns

List of supported feature atoms.

Examples

iex> TerminalPlatform.get_supported_features()
[:true_color, :unicode, :mouse, :clipboard]

get_terminal_capabilities()

@spec get_terminal_capabilities() :: map()

Returns detailed information about the current terminal's capabilities.

Returns

A map containing terminal capabilities including:

  • :name - Terminal name/type
  • :version - Terminal version if available
  • :features - List of supported features
  • :colors - Color support information
  • :unicode - Unicode support details
  • :input - Input capabilities
  • :output - Output capabilities

Examples

iex> TerminalPlatform.get_terminal_capabilities()
%{
  name: "iTerm2",
  version: "3.5.0",
  features: [:true_color, :unicode, :mouse, :clipboard],
  colors: %{
    basic: true,
    true_color: true,
    palette: "default"
  },
  unicode: %{
    support: true,
    width: :ambiguous,
    emoji: true
  },
  input: %{
    mouse: true,
    bracketed_paste: true,
    focus: true
  },
  output: %{
    title: true,
    bell: true,
    alternate_screen: true
  }
}

supports_feature?(feature)

@spec supports_feature?(terminal_feature()) :: boolean()

Checks if a specific terminal feature is supported.

Parameters

  • feature - Feature to check for support

Returns

  • true - Feature is supported
  • false - Feature is not supported

Examples

iex> TerminalPlatform.supports_feature?(:true_color)
true