diff --git a/src/app.rs b/src/app.rs index f58fb17..add1b6d 100644 --- a/src/app.rs +++ b/src/app.rs @@ -431,7 +431,7 @@ impl Tile { let mut exact: Vec = filter_vec .par_iter() .filter(|x| match &x.open_command { - Function::RunShellCommand(_) => x + Function::RunShellCommand => x .name_lc .starts_with(query.split_once(" ").unwrap_or((&query, "")).0), _ => x.name_lc == query, @@ -442,7 +442,7 @@ impl Tile { let mut prefix: Vec = filter_vec .par_iter() .filter(|x| match x.open_command { - Function::RunShellCommand(_) => false, + Function::RunShellCommand => false, _ => x.name_lc != query && x.name_lc.starts_with(&query), }) .cloned() diff --git a/src/commands.rs b/src/commands.rs index 892804a..2fe8fce 100644 --- a/src/commands.rs +++ b/src/commands.rs @@ -9,7 +9,7 @@ use crate::config::Config; #[derive(Debug, Clone)] pub enum Function { OpenApp(String), - RunShellCommand(String), + RunShellCommand, RandomVar(i32), GoogleSearch(String), OpenPrefPane, @@ -24,18 +24,8 @@ impl Function { &objc2_foundation::NSString::from_str(path), )); } - Function::RunShellCommand(shell_command) => { - let mut final_command = shell_command.to_owned(); - - for (argument_num, argument) in query.split_whitespace().enumerate() { - final_command = - final_command.replace(&format!("$var{}", argument_num), argument); - } - Command::new("sh") - .arg("-c") - .arg(final_command) - .status() - .ok(); + Function::RunShellCommand => { + Command::new("sh").arg("-c").arg(query).status().ok(); } Function::RandomVar(var) => { Clipboard::new() diff --git a/src/config.rs b/src/config.rs index df670a9..d70be14 100644 --- a/src/config.rs +++ b/src/config.rs @@ -140,7 +140,7 @@ impl Shelly { } }); App { - open_command: Function::RunShellCommand(self_clone.command), + open_command: Function::RunShellCommand, icons: icon, name: self_clone.alias, name_lc: self_clone.alias_lc,