fix: remove duplicate TtyMetaPlugin implementation

Co-authored-by: aider (openai/andrew.openrouter.qwen.qwen3-coder) <aider@aider.chat>
This commit is contained in:
Andrew Phillips
2025-07-29 14:46:57 -03:00
parent ebefa22074
commit 6b34f2e226

View File

@@ -359,42 +359,3 @@ impl MetaPlugin for FullHostnameMetaPlugin {
} }
} }
#[derive(Debug, Clone, Default)]
pub struct TtyMetaPlugin {
meta_name: String,
}
impl TtyMetaPlugin {
pub fn new() -> TtyMetaPlugin {
TtyMetaPlugin {
meta_name: "tty".to_string(),
}
}
}
impl MetaPlugin for TtyMetaPlugin {
fn create(&self) -> Result<Box<dyn Write>> {
Ok(Box::new(io::sink()))
}
fn finalize(&mut self) -> io::Result<String> {
// Use isatty::tty_path to get the current TTY path
match isatty::stdout_isatty() {
true => {
match isatty::tty_path() {
Ok(path) => Ok(path.to_string_lossy().to_string()),
Err(_) => Ok("unknown tty".to_string()),
}
},
false => Ok("not a tty".to_string()),
}
}
fn update(&mut self, _data: &[u8]) {
// No update needed for TTY
}
fn meta_name(&mut self) -> String {
self.meta_name.clone()
}
}