Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Merged
merged 1 commit into from
Nov 26, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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)]
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Out of curiosity, was this checked-in by mistake?

Copy link
Owner Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

No, this actually fixes a feat I added yesterday. Just threw it in for conveniency since it's such a small change to avoid making a separate PR.

pub input_bar_position: InputPosition,
}

Expand Down