mirror of
https://github.com/alexpasmantier/television.git
synced 2025-06-07 03:55: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;
|
use devicons::FileIcon;
|
||||||
|
|
||||||
// NOTE: having an enum for entry types would be nice since it would allow
|
// 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 {
|
pub fn stdout_repr(&self) -> String {
|
||||||
let mut repr = self.name.clone();
|
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.insert(0, '\'');
|
||||||
repr.push('\'');
|
repr.push('\'');
|
||||||
}
|
}
|
||||||
|
@ -11,6 +11,7 @@ pub struct UiConfig {
|
|||||||
pub use_nerd_font_icons: bool,
|
pub use_nerd_font_icons: bool,
|
||||||
pub ui_scale: u16,
|
pub ui_scale: u16,
|
||||||
pub show_help_bar: bool,
|
pub show_help_bar: bool,
|
||||||
|
#[serde(default)]
|
||||||
pub input_bar_position: InputPosition,
|
pub input_bar_position: InputPosition,
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user