aboutsummaryrefslogtreecommitdiffstats
path: root/src/widgets/command.rs
diff options
context:
space:
mode:
authorDaniel Jankowski <daniel.jankowski@rub.de>2025-06-09 13:54:57 +0200
committerDaniel Jankowski <daniel.jankowski@rub.de>2025-06-09 13:54:57 +0200
commit18bf55e7057d46e57650d2a67b5a9312d8cc6b65 (patch)
tree23b3eac268793f304fc14cabd264524d57a55ac3 /src/widgets/command.rs
parentchore: remove test code (diff)
downloadsl0pstatus-18bf55e7057d46e57650d2a67b5a9312d8cc6b65.tar.gz
sl0pstatus-18bf55e7057d46e57650d2a67b5a9312d8cc6b65.tar.xz
sl0pstatus-18bf55e7057d46e57650d2a67b5a9312d8cc6b65.zip
fix(command): handle raw formatting correctly
Diffstat (limited to '')
-rw-r--r--src/widgets/command.rs10
1 files changed, 7 insertions, 3 deletions
diff --git a/src/widgets/command.rs b/src/widgets/command.rs
index c5a902f..5385dff 100644
--- a/src/widgets/command.rs
+++ b/src/widgets/command.rs
@@ -2,7 +2,7 @@ use kdl::{KdlDocument, KdlError};
use lazy_static::lazy_static;
use std::{
collections::BTreeMap,
- fs::{remove_file, File},
+ fs::{File, remove_file},
ops::Sub,
path::{Path, PathBuf},
};
@@ -12,7 +12,7 @@ use regex::Regex;
#[cfg(all(not(feature = "bench"), not(test)))]
use zellij_tile::shim::{run_command, run_command_with_env_variables_and_cwd};
-use crate::render::{formatted_parts_from_string_cached, FormattedPart};
+use crate::render::{FormattedPart, formatted_parts_from_string_cached};
use crate::{config::ZellijState, widgets::widget::Widget};
@@ -126,7 +126,11 @@ impl Widget for CommandWidget {
match command_config.render_mode {
RenderMode::Static => content,
RenderMode::Dynamic => render_dynamic_formatted_content(&content, &self.zj_conf),
- RenderMode::Raw => content,
+ RenderMode::Raw => command_result
+ .stdout
+ .strip_suffix('\n')
+ .unwrap_or(&command_result.stdout)
+ .to_owned(),
}
}