Vtex.Output.OSC (Vtex v0.1.0)

Copy Markdown View Source

Operating System Command output sequences: window title and hyperlinks.

These are the OSC counterparts to the CSI output in Vtex.Output.Cursor / Vtex.Output.Screen, and like everything else in Vtex they return iodata for you to write.

OSC sequences end with a String Terminator; these use BEL (0x07), the form every common terminal accepts.

Summary

Functions

Build a clickable hyperlink (OSC 8): text that links to url.

Set the terminal window (and icon) title. Mirrors xterm's OSC 0.

Functions

hyperlink(text, url)

@spec hyperlink(String.t(), String.t()) :: binary()

Build a clickable hyperlink (OSC 8): text that links to url.

Terminals that support it render text as a link; others just show text.

Examples

iex> Vtex.Output.OSC.hyperlink("Anthropic", "https://anthropic.com")
"\e]8;;https://anthropic.com\aAnthropic\e]8;;\a"

title(text)

@spec title(String.t()) :: binary()

Set the terminal window (and icon) title. Mirrors xterm's OSC 0.

Examples

iex> Vtex.Output.OSC.title("My BBS")
"\e]0;My BBS\a"