module
Opal::Terminal::OSC
Overview
Operating System Command (OSC) escape sequences for modern terminal emulators.
Defined in:
opal/terminal/osc.crConstant Summary
-
OSC8_REGEX =
/\e\]8;([^;]*);([^\a\e]*)(?:\a|\e\\)(.*?)\e\]8;;(?:\a|\e\\)/m
Class Method Summary
-
.clipboard_copy(text : String, target : Char = 'c') : String
Generates an OSC 52 clipboard copy escape sequence using strict Base64 encoding.
-
.copy_to_clipboard(text : String, io : IO = STDOUT, target : Char = 'c') : Nil
Directly copies text to the system clipboard via STDOUT using OSC 52.
-
.discussion_link(repo : String, number : Int32 | String, label : String | Nil = nil, id : String | Nil = nil) : String
Generates an OSC 8 clickable hyperlink for a GitHub Discussion (
Discussion #XX). -
.github_link(repo : String, kind : Symbol | String, number : Int32 | String, label : String | Nil = nil, id : String | Nil = nil) : String
Generates an OSC 8 clickable hyperlink to a GitHub RFC/Discussion, Issue, or PR.
-
.github_url(repo : String, kind : Symbol | String = :repo, number : Int32 | String | Nil = nil) : String
Constructs a canonical GitHub URL for a repository, RFC/discussion, issue, or pull request.
-
.hyperlink(text : String, url : String, id : String | Nil = nil) : String
Generates an OSC 8 clickable hyperlink escape sequence.
-
.issue_link(repo : String, number : Int32 | String, label : String | Nil = nil, id : String | Nil = nil) : String
Generates an OSC 8 clickable hyperlink for a GitHub Issue (
Issue #XX). -
.link(url : String, label : String | Nil = nil, id : String | Nil = nil) : String
Declarative
link(url, label)OSC 8 terminal hyperlink helper. -
.normalize_github_repo(repo : String, default_owner : String = "sol-vin") : String
Normalizes a GitHub repository identifier (e.g.
-
.parse_links(text : String) : Array(LinkSpan)
Parses all OSC 8 hyperlink spans contained within a string.
-
.pr_link(repo : String, number : Int32 | String, label : String | Nil = nil, id : String | Nil = nil) : String
Generates an OSC 8 clickable hyperlink for a GitHub Pull Request (
PR #XX). -
.resolve_link_args(first : String, second : String | Nil = nil) : Tuple(String, String)
Normalizes
(url, label)arguments while remaining backward-compatible with(label, url)when the second argument is an explicit URL. -
.rfc_link(repo : String, number : Int32 | String, label : String | Nil = nil, id : String | Nil = nil) : String
Generates an OSC 8 clickable hyperlink for a GitHub RFC Discussion (
RFC #XX). -
.url_like?(value : String) : Bool
Returns true if the string begins with a standard URI scheme.
Class Method Detail
Generates an OSC 52 clipboard copy escape sequence using strict Base64 encoding. Allows copying text directly into the host OS clipboard over SSH and local terminal sessions. clipboard target: 'c' = primary clipboard, 'p' = selection clipboard
Directly copies text to the system clipboard via STDOUT using OSC 52.
Generates an OSC 8 clickable hyperlink for a GitHub Discussion (Discussion #XX).
Generates an OSC 8 clickable hyperlink to a GitHub RFC/Discussion, Issue, or PR.
Constructs a canonical GitHub URL for a repository, RFC/discussion, issue, or pull request.
Generates an OSC 8 clickable hyperlink escape sequence. Supported by Windows Terminal, iTerm2, Kitty, WezTerm, Alacritty, GNOME Terminal, etc.
Generates an OSC 8 clickable hyperlink for a GitHub Issue (Issue #XX).
Declarative link(url, label) OSC 8 terminal hyperlink helper.
If label is omitted, defaults to url. Also supports (label, url) if second is a URI.
Normalizes a GitHub repository identifier (e.g. "opal" -> "sol-vin/opal").
Parses all OSC 8 hyperlink spans contained within a string.
Generates an OSC 8 clickable hyperlink for a GitHub Pull Request (PR #XX).
Normalizes (url, label) arguments while remaining backward-compatible
with (label, url) when the second argument is an explicit URL.
Generates an OSC 8 clickable hyperlink for a GitHub RFC Discussion (RFC #XX).
Returns true if the string begins with a standard URI scheme.