Skip to content

Commit

Permalink
fix(output): quote output string when it contains spaces and points t…
Browse files Browse the repository at this point in the history
…o an existing path (#77)
  • Loading branch information
alexpasmantier authored Nov 26, 2024
1 parent 2206711 commit 1ebec7e
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 1 deletion.
6 changes: 5 additions & 1 deletion crates/television-channels/src/entry.rs
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
use std::path::PathBuf;

use devicons::FileIcon;

// NOTE: having an enum for entry types would be nice since it would allow
Expand Down Expand Up @@ -92,7 +94,9 @@ impl Entry {

pub fn stdout_repr(&self) -> String {
let mut repr = self.name.clone();
if repr.contains(|c| char::is_ascii_whitespace(&c)) {
if PathBuf::from(&repr).exists()
&& repr.contains(|c| char::is_ascii_whitespace(&c))
{
repr.insert(0, '\'');
repr.push('\'');
}
Expand Down
1 change: 1 addition & 0 deletions crates/television/config/ui.rs
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ pub struct UiConfig {
pub use_nerd_font_icons: bool,
pub ui_scale: u16,
pub show_help_bar: bool,
#[serde(default)]
pub input_bar_position: InputPosition,
}

Expand Down

0 comments on commit 1ebec7e

Please sign in to comment.