From 239461e520ae7524d1cde468c1a71cba5e2cbd46 Mon Sep 17 00:00:00 2001 From: Ralph Caraveo Date: Fri, 10 Jul 2020 21:47:10 -0700 Subject: [PATCH] just render the original command --- src/extension/shell.rs | 16 ++++++++++------ 1 file changed, 10 insertions(+), 6 deletions(-) diff --git a/src/extension/shell.rs b/src/extension/shell.rs index ad3dad5..1907513 100644 --- a/src/extension/shell.rs +++ b/src/extension/shell.rs @@ -17,7 +17,7 @@ * along with espanso. If not, see . */ -use log::{info, error, warn}; +use log::{error, info, warn}; use regex::{Captures, Regex}; use serde_yaml::{Mapping, Value}; use std::process::{Command, Output}; @@ -126,11 +126,12 @@ impl super::Extension for ShellExtension { warn!("No 'cmd' parameter specified for shell variable"); return None; } - let cmd = cmd.unwrap().as_str().unwrap(); + + let original_cmd = cmd.unwrap().as_str().unwrap(); // Render positional parameters in args let cmd = POS_ARG_REGEX - .replace_all(&cmd, |caps: &Captures| { + .replace_all(&original_cmd, |caps: &Captures| { let position_str = caps.name("pos").unwrap().as_str(); let position = position_str.parse::().unwrap_or(-1); if position >= 0 && position < args.len() as i32 { @@ -176,12 +177,15 @@ impl super::Extension for ShellExtension { let with_debug = if let Some(value) = debug_opt { let val = value.as_bool(); val.unwrap_or(false) - }else{ + } else { false }; - + if with_debug { - info!("debug for shell cmd '{}', exit_status '{}', stdout '{}', stderr '{}'", cmd, output.status, output_str, error_str); + info!( + "debug for shell cmd '{}', exit_status '{}', stdout '{}', stderr '{}'", + original_cmd, output.status, output_str, error_str + ); } // If specified, trim the output