mirror of
https://github.com/asciinema/asciinema.git
synced 2025-12-15 19:28:00 +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("TERM".to_owned(), "xterm256-color".to_owned());
|
||||
|
||||
let theme = TtyTheme {
|
||||
let tty_theme = TtyTheme {
|
||||
fg: RGB8::new(0, 1, 2),
|
||||
bg: RGB8::new(0, 100, 200),
|
||||
palette: vec![
|
||||
@@ -365,7 +365,7 @@ mod tests {
|
||||
command: Some("/bin/bash".to_owned()),
|
||||
title: Some("Demo".to_owned()),
|
||||
env: Some(env),
|
||||
term_theme: Some(theme),
|
||||
term_theme: Some(tty_theme),
|
||||
..Default::default()
|
||||
};
|
||||
|
||||
|
||||
@@ -371,24 +371,24 @@ impl From<&Header> for V2Header {
|
||||
}
|
||||
|
||||
impl From<&TtyTheme> for V2Theme {
|
||||
fn from(theme: &TtyTheme) -> Self {
|
||||
let palette = theme.palette.iter().copied().map(RGB8).collect();
|
||||
fn from(tty_theme: &TtyTheme) -> Self {
|
||||
let palette = tty_theme.palette.iter().copied().map(RGB8).collect();
|
||||
|
||||
V2Theme {
|
||||
fg: RGB8(theme.fg),
|
||||
bg: RGB8(theme.bg),
|
||||
fg: RGB8(tty_theme.fg),
|
||||
bg: RGB8(tty_theme.bg),
|
||||
palette: V2Palette(palette),
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
impl From<&V2Theme> for TtyTheme {
|
||||
fn from(theme: &V2Theme) -> Self {
|
||||
let palette = theme.palette.0.iter().map(|c| c.0).collect();
|
||||
fn from(tty_theme: &V2Theme) -> Self {
|
||||
let palette = tty_theme.palette.0.iter().map(|c| c.0).collect();
|
||||
|
||||
TtyTheme {
|
||||
fg: theme.fg.0,
|
||||
bg: theme.bg.0,
|
||||
fg: tty_theme.fg.0,
|
||||
bg: tty_theme.bg.0,
|
||||
palette,
|
||||
}
|
||||
}
|
||||
|
||||
@@ -425,24 +425,24 @@ impl From<&Header> for V3Header {
|
||||
}
|
||||
|
||||
impl From<&TtyTheme> for V3Theme {
|
||||
fn from(theme: &TtyTheme) -> Self {
|
||||
let palette = theme.palette.iter().copied().map(RGB8).collect();
|
||||
fn from(tty_theme: &TtyTheme) -> Self {
|
||||
let palette = tty_theme.palette.iter().copied().map(RGB8).collect();
|
||||
|
||||
V3Theme {
|
||||
fg: RGB8(theme.fg),
|
||||
bg: RGB8(theme.bg),
|
||||
fg: RGB8(tty_theme.fg),
|
||||
bg: RGB8(tty_theme.bg),
|
||||
palette: V3Palette(palette),
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
impl From<&V3Theme> for TtyTheme {
|
||||
fn from(theme: &V3Theme) -> Self {
|
||||
let palette = theme.palette.0.iter().map(|c| c.0).collect();
|
||||
fn from(tty_theme: &V3Theme) -> Self {
|
||||
let palette = tty_theme.palette.0.iter().map(|c| c.0).collect();
|
||||
|
||||
TtyTheme {
|
||||
fg: theme.fg.0,
|
||||
bg: theme.bg.0,
|
||||
fg: tty_theme.fg.0,
|
||||
bg: tty_theme.bg.0,
|
||||
palette,
|
||||
}
|
||||
}
|
||||
|
||||
@@ -35,7 +35,7 @@ impl session::OutputStarter for FileWriterStarter {
|
||||
mut self: Box<Self>,
|
||||
time: SystemTime,
|
||||
tty_size: TtySize,
|
||||
theme: Option<TtyTheme>,
|
||||
tty_theme: Option<TtyTheme>,
|
||||
) -> io::Result<Box<dyn session::Output>> {
|
||||
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_type: self.metadata.term_type,
|
||||
term_version: self.metadata.term_version,
|
||||
term_theme: theme,
|
||||
term_theme: tty_theme,
|
||||
timestamp: Some(timestamp),
|
||||
idle_time_limit: self.metadata.idle_time_limit,
|
||||
command: self.metadata.command.as_ref().cloned(),
|
||||
|
||||
@@ -25,7 +25,7 @@ use crate::tty::{Tty, TtySize, TtyTheme};
|
||||
type ExtraEnv = HashMap<String, String>;
|
||||
|
||||
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 {
|
||||
@@ -396,7 +396,7 @@ mod tests {
|
||||
}
|
||||
|
||||
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 {
|
||||
tty_size,
|
||||
output: Vec::new(),
|
||||
|
||||
@@ -23,7 +23,7 @@ pub trait OutputStarter {
|
||||
self: Box<Self>,
|
||||
time: SystemTime,
|
||||
tty_size: TtySize,
|
||||
theme: Option<TtyTheme>,
|
||||
tty_theme: Option<TtyTheme>,
|
||||
) -> io::Result<Box<dyn Output>>;
|
||||
}
|
||||
|
||||
|
||||
@@ -174,13 +174,13 @@ impl session::OutputStarter for OutputStarter {
|
||||
self: Box<Self>,
|
||||
_time: SystemTime,
|
||||
tty_size: TtySize,
|
||||
theme: Option<TtyTheme>,
|
||||
tty_theme: Option<TtyTheme>,
|
||||
) -> io::Result<Box<dyn session::Output>> {
|
||||
let (stream_tx, stream_rx) = mpsc::unbounded_channel();
|
||||
let request_rx = self.request_rx;
|
||||
|
||||
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)))
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user