fix(output): quote output string when it contains spaces and points to an existing path (#77)

This commit is contained in:
Alexandre Pasmantier 2024-11-26 10:53:14 +01:00 committed by GitHub
parent 220671106e
commit 1ebec7ead2
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
2 changed files with 6 additions and 1 deletions

View File

@ -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
@ -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('\'');
}

View File

@ -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,
}