1
1
mirror of https://github.com/wez/wezterm.git synced 2024-12-25 14:22:37 +03:00

add Display + Debug impl for SpawnCommand

This makes it look tidier in the launcher menu
This commit is contained in:
Wez Furlong 2022-01-03 23:19:11 -07:00
parent 509122c152
commit 5ddb40c7c8

View File

@ -76,7 +76,7 @@ impl Default for SpawnTabDomain {
} }
} }
#[derive(Default, Debug, Clone, Deserialize, Serialize, PartialEq, Eq)] #[derive(Default, Clone, Deserialize, Serialize, PartialEq, Eq)]
pub struct SpawnCommand { pub struct SpawnCommand {
/// Optional descriptive label /// Optional descriptive label
pub label: Option<String>, pub label: Option<String>,
@ -104,6 +104,32 @@ pub struct SpawnCommand {
pub domain: SpawnTabDomain, pub domain: SpawnTabDomain,
} }
impl std::fmt::Debug for SpawnCommand {
fn fmt(&self, fmt: &mut std::fmt::Formatter) -> std::fmt::Result {
write!(fmt, "{}", self)
}
}
impl std::fmt::Display for SpawnCommand {
fn fmt(&self, fmt: &mut std::fmt::Formatter) -> std::fmt::Result {
write!(fmt, "SpawnCommand")?;
if let Some(label) = &self.label {
write!(fmt, " label='{}'", label)?;
}
write!(fmt, " domain={:?}", self.domain)?;
if let Some(args) = &self.args {
write!(fmt, " args={:?}", args)?;
}
if let Some(cwd) = &self.cwd {
write!(fmt, " cwd={}", cwd.display())?;
}
for (k, v) in &self.set_environment_variables {
write!(fmt, " {}={}", k, v)?;
}
Ok(())
}
}
#[derive(Debug, Clone, Copy, Deserialize, Serialize, PartialEq, Eq)] #[derive(Debug, Clone, Copy, Deserialize, Serialize, PartialEq, Eq)]
pub enum PaneDirection { pub enum PaneDirection {
Up, Up,