mirror of
https://github.com/asciinema/asciinema.git
synced 2025-12-16 03:38:03 +01:00
Improve arg/var naming consistency
This commit is contained in:
@@ -336,7 +336,7 @@ mod tests {
|
|||||||
env.insert("SHELL".to_owned(), "/usr/bin/fish".to_owned());
|
env.insert("SHELL".to_owned(), "/usr/bin/fish".to_owned());
|
||||||
env.insert("TERM".to_owned(), "xterm256-color".to_owned());
|
env.insert("TERM".to_owned(), "xterm256-color".to_owned());
|
||||||
|
|
||||||
let theme = TtyTheme {
|
let tty_theme = TtyTheme {
|
||||||
fg: RGB8::new(0, 1, 2),
|
fg: RGB8::new(0, 1, 2),
|
||||||
bg: RGB8::new(0, 100, 200),
|
bg: RGB8::new(0, 100, 200),
|
||||||
palette: vec![
|
palette: vec![
|
||||||
@@ -365,7 +365,7 @@ mod tests {
|
|||||||
command: Some("/bin/bash".to_owned()),
|
command: Some("/bin/bash".to_owned()),
|
||||||
title: Some("Demo".to_owned()),
|
title: Some("Demo".to_owned()),
|
||||||
env: Some(env),
|
env: Some(env),
|
||||||
term_theme: Some(theme),
|
term_theme: Some(tty_theme),
|
||||||
..Default::default()
|
..Default::default()
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|||||||
@@ -371,24 +371,24 @@ impl From<&Header> for V2Header {
|
|||||||
}
|
}
|
||||||
|
|
||||||
impl From<&TtyTheme> for V2Theme {
|
impl From<&TtyTheme> for V2Theme {
|
||||||
fn from(theme: &TtyTheme) -> Self {
|
fn from(tty_theme: &TtyTheme) -> Self {
|
||||||
let palette = theme.palette.iter().copied().map(RGB8).collect();
|
let palette = tty_theme.palette.iter().copied().map(RGB8).collect();
|
||||||
|
|
||||||
V2Theme {
|
V2Theme {
|
||||||
fg: RGB8(theme.fg),
|
fg: RGB8(tty_theme.fg),
|
||||||
bg: RGB8(theme.bg),
|
bg: RGB8(tty_theme.bg),
|
||||||
palette: V2Palette(palette),
|
palette: V2Palette(palette),
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
impl From<&V2Theme> for TtyTheme {
|
impl From<&V2Theme> for TtyTheme {
|
||||||
fn from(theme: &V2Theme) -> Self {
|
fn from(tty_theme: &V2Theme) -> Self {
|
||||||
let palette = theme.palette.0.iter().map(|c| c.0).collect();
|
let palette = tty_theme.palette.0.iter().map(|c| c.0).collect();
|
||||||
|
|
||||||
TtyTheme {
|
TtyTheme {
|
||||||
fg: theme.fg.0,
|
fg: tty_theme.fg.0,
|
||||||
bg: theme.bg.0,
|
bg: tty_theme.bg.0,
|
||||||
palette,
|
palette,
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -425,24 +425,24 @@ impl From<&Header> for V3Header {
|
|||||||
}
|
}
|
||||||
|
|
||||||
impl From<&TtyTheme> for V3Theme {
|
impl From<&TtyTheme> for V3Theme {
|
||||||
fn from(theme: &TtyTheme) -> Self {
|
fn from(tty_theme: &TtyTheme) -> Self {
|
||||||
let palette = theme.palette.iter().copied().map(RGB8).collect();
|
let palette = tty_theme.palette.iter().copied().map(RGB8).collect();
|
||||||
|
|
||||||
V3Theme {
|
V3Theme {
|
||||||
fg: RGB8(theme.fg),
|
fg: RGB8(tty_theme.fg),
|
||||||
bg: RGB8(theme.bg),
|
bg: RGB8(tty_theme.bg),
|
||||||
palette: V3Palette(palette),
|
palette: V3Palette(palette),
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
impl From<&V3Theme> for TtyTheme {
|
impl From<&V3Theme> for TtyTheme {
|
||||||
fn from(theme: &V3Theme) -> Self {
|
fn from(tty_theme: &V3Theme) -> Self {
|
||||||
let palette = theme.palette.0.iter().map(|c| c.0).collect();
|
let palette = tty_theme.palette.0.iter().map(|c| c.0).collect();
|
||||||
|
|
||||||
TtyTheme {
|
TtyTheme {
|
||||||
fg: theme.fg.0,
|
fg: tty_theme.fg.0,
|
||||||
bg: theme.bg.0,
|
bg: tty_theme.bg.0,
|
||||||
palette,
|
palette,
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -35,7 +35,7 @@ impl session::OutputStarter for FileWriterStarter {
|
|||||||
mut self: Box<Self>,
|
mut self: Box<Self>,
|
||||||
time: SystemTime,
|
time: SystemTime,
|
||||||
tty_size: TtySize,
|
tty_size: TtySize,
|
||||||
theme: Option<TtyTheme>,
|
tty_theme: Option<TtyTheme>,
|
||||||
) -> io::Result<Box<dyn session::Output>> {
|
) -> io::Result<Box<dyn session::Output>> {
|
||||||
let timestamp = time.duration_since(UNIX_EPOCH).unwrap().as_secs();
|
let timestamp = time.duration_since(UNIX_EPOCH).unwrap().as_secs();
|
||||||
|
|
||||||
@@ -44,7 +44,7 @@ impl session::OutputStarter for FileWriterStarter {
|
|||||||
term_rows: tty_size.1,
|
term_rows: tty_size.1,
|
||||||
term_type: self.metadata.term_type,
|
term_type: self.metadata.term_type,
|
||||||
term_version: self.metadata.term_version,
|
term_version: self.metadata.term_version,
|
||||||
term_theme: theme,
|
term_theme: tty_theme,
|
||||||
timestamp: Some(timestamp),
|
timestamp: Some(timestamp),
|
||||||
idle_time_limit: self.metadata.idle_time_limit,
|
idle_time_limit: self.metadata.idle_time_limit,
|
||||||
command: self.metadata.command.as_ref().cloned(),
|
command: self.metadata.command.as_ref().cloned(),
|
||||||
|
|||||||
@@ -25,7 +25,7 @@ use crate::tty::{Tty, TtySize, TtyTheme};
|
|||||||
type ExtraEnv = HashMap<String, String>;
|
type ExtraEnv = HashMap<String, String>;
|
||||||
|
|
||||||
pub trait HandlerStarter<H: Handler> {
|
pub trait HandlerStarter<H: Handler> {
|
||||||
fn start(self, tty_size: TtySize, theme: Option<TtyTheme>) -> H;
|
fn start(self, tty_size: TtySize, tty_theme: Option<TtyTheme>) -> H;
|
||||||
}
|
}
|
||||||
|
|
||||||
pub trait Handler {
|
pub trait Handler {
|
||||||
@@ -396,7 +396,7 @@ mod tests {
|
|||||||
}
|
}
|
||||||
|
|
||||||
impl HandlerStarter<TestHandler> for TestHandlerStarter {
|
impl HandlerStarter<TestHandler> for TestHandlerStarter {
|
||||||
fn start(self, tty_size: TtySize, _theme: Option<TtyTheme>) -> TestHandler {
|
fn start(self, tty_size: TtySize, _tty_theme: Option<TtyTheme>) -> TestHandler {
|
||||||
TestHandler {
|
TestHandler {
|
||||||
tty_size,
|
tty_size,
|
||||||
output: Vec::new(),
|
output: Vec::new(),
|
||||||
|
|||||||
@@ -23,7 +23,7 @@ pub trait OutputStarter {
|
|||||||
self: Box<Self>,
|
self: Box<Self>,
|
||||||
time: SystemTime,
|
time: SystemTime,
|
||||||
tty_size: TtySize,
|
tty_size: TtySize,
|
||||||
theme: Option<TtyTheme>,
|
tty_theme: Option<TtyTheme>,
|
||||||
) -> io::Result<Box<dyn Output>>;
|
) -> io::Result<Box<dyn Output>>;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -174,13 +174,13 @@ impl session::OutputStarter for OutputStarter {
|
|||||||
self: Box<Self>,
|
self: Box<Self>,
|
||||||
_time: SystemTime,
|
_time: SystemTime,
|
||||||
tty_size: TtySize,
|
tty_size: TtySize,
|
||||||
theme: Option<TtyTheme>,
|
tty_theme: Option<TtyTheme>,
|
||||||
) -> io::Result<Box<dyn session::Output>> {
|
) -> io::Result<Box<dyn session::Output>> {
|
||||||
let (stream_tx, stream_rx) = mpsc::unbounded_channel();
|
let (stream_tx, stream_rx) = mpsc::unbounded_channel();
|
||||||
let request_rx = self.request_rx;
|
let request_rx = self.request_rx;
|
||||||
|
|
||||||
self.handle
|
self.handle
|
||||||
.spawn(async move { run(tty_size, theme, stream_rx, request_rx).await });
|
.spawn(async move { run(tty_size, tty_theme, stream_rx, request_rx).await });
|
||||||
|
|
||||||
Ok(Box::new(Output(stream_tx)))
|
Ok(Box::new(Output(stream_tx)))
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user