mirror of
https://github.com/alexpasmantier/television.git
synced 2025-06-06 03:25:23 +00:00
fix(output): quote output string when it contains spaces and points to an existing path (#77)
This commit is contained in:
parent
220671106e
commit
1ebec7ead2
@ -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('\'');
|
||||
}
|
||||
|
@ -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,
|
||||
}
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user