pub enum TerminalProgram {
Dumb,
Ansi,
ITerm2,
Terminology,
Kitty,
WezTerm,
VSCode,
Ghostty,
}
Expand description
A terminal application.
Variants§
Dumb
A dumb terminal which does not support any formatting.
Ansi
A plain ANSI terminal which supports only standard ANSI formatting.
ITerm2
iTerm2.
iTerm2 is a powerful macOS terminal emulator with many formatting features, including images and inline links.
See https://www.iterm2.com for more information.
Terminology
Terminology.
See http://terminolo.gy for more information.
Kitty
Kitty.
kitty is a fast, featureful, GPU-based terminal emulator with a lot of extensions to the terminal protocol.
See https://sw.kovidgoyal.net/kitty/ for more information.
WezTerm
WezTerm
WezTerm is a GPU-accelerated cross-platform terminal emulator and multiplexer. It’s highly customizable and supports some terminal extensions.
See https://wezfurlong.org/wezterm/ for more information.
VSCode
The built-in terminal in VSCode.
Since version 1.80 it supports images with the iTerm2 protocol.
Ghostty
Ghostty.
See https://mitchellh.com/ghostty for more information.
Implementations§
Source§impl TerminalProgram
impl TerminalProgram
Sourcepub fn detect() -> Self
pub fn detect() -> Self
Attempt to detect the terminal program mdcat is running on.
This function looks at various environment variables to identify the terminal program.
It first looks at $TERM
to determine the terminal program, then at $TERM_PROGRAM
, and
finally at $TERMINOLOGY
.
If $TERM
is set to anything other than xterm-256colors
it’s definitely accurate, since
it points to the terminfo entry to use. $TERM
also propagates across most boundaries
(e.g. sudo
, ssh
), and thus the most reliable place to check.
However, $TERM
only works if the terminal has a dedicated entry in terminfo database. Many
terminal programs avoid this complexity (even WezTerm only sets $TERM
if explicitly
configured to do so), so mdcat
proceeds to look at other variables. However, these are
generally not as reliable as $TERM
, because they often do not propagate across SSH or
sudo, and may leak if one terminal program is started from another one.
§Returns
TerminalProgram::Kitty
if$TERM
isxterm-kitty
.TerminalProgram::WezTerm
if$TERM
iswezterm
.TerminalProgram::WezTerm
if$TERM_PROGRAM
isWezTerm
.TerminalProgram::ITerm2
if$TERM_PROGRAM
isiTerm.app
.TerminalProgram::Ghostty
if$TERM
isxterm-ghostty
.TerminalProgram::Ghostty
if$TERM_PROGRAM
isghostty
.TerminalProgram::Terminology
if$TERMINOLOGY
is1
.TerminalProgram::Ansi
otherwise.
Sourcepub fn capabilities(self) -> TerminalCapabilities
pub fn capabilities(self) -> TerminalCapabilities
Get the capabilities of this terminal emulator.
Trait Implementations§
Source§impl Clone for TerminalProgram
impl Clone for TerminalProgram
Source§fn clone(&self) -> TerminalProgram
fn clone(&self) -> TerminalProgram
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source
. Read moreSource§impl Debug for TerminalProgram
impl Debug for TerminalProgram
Source§impl Display for TerminalProgram
impl Display for TerminalProgram
Source§impl PartialEq for TerminalProgram
impl PartialEq for TerminalProgram
impl Copy for TerminalProgram
impl Eq for TerminalProgram
impl StructuralPartialEq for TerminalProgram
Auto Trait Implementations§
impl Freeze for TerminalProgram
impl RefUnwindSafe for TerminalProgram
impl Send for TerminalProgram
impl Sync for TerminalProgram
impl Unpin for TerminalProgram
impl UnwindSafe for TerminalProgram
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<T> Instrument for T
impl<T> Instrument for T
Source§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
Source§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
self
into a Left
variant of Either<Self, Self>
if into_left
is true
.
Converts self
into a Right
variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
self
into a Left
variant of Either<Self, Self>
if into_left(&self)
returns true
.
Converts self
into a Right
variant of Either<Self, Self>
otherwise. Read more