From 21cdaaee42fade21f43014c983bb650352f61926 Mon Sep 17 00:00:00 2001 From: Fred Morcos Date: Thu, 21 Nov 2024 00:29:49 +0100 Subject: [PATCH] fix: quote file names that contain spaces when printing them to stdout (#51) --- crates/television-channels/src/entry.rs | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/crates/television-channels/src/entry.rs b/crates/television-channels/src/entry.rs index 14c3ea8..128c953 100644 --- a/crates/television-channels/src/entry.rs +++ b/crates/television-channels/src/entry.rs @@ -105,6 +105,10 @@ impl Entry { pub fn stdout_repr(&self) -> String { let mut repr = self.name.clone(); + if repr.contains(|c| char::is_ascii_whitespace(&c)) { + repr.insert(0, '\''); + repr.push('\''); + } if let Some(line_number) = self.line_number { repr.push_str(&format!(":{line_number}")); }