mirror of
https://github.com/TECHNOFAB11/pay-respects.git
synced 2025-12-12 14:30:10 +01:00
fix: check executable in nushell
This commit is contained in:
parent
c2708a4de5
commit
6a06aa5954
3 changed files with 26 additions and 12 deletions
|
|
@ -166,17 +166,7 @@ fn parse_conditions(suggest: &str) -> (String, Vec<TokenStream2>) {
|
|||
|
||||
fn eval_condition(condition: &str, arg: &str) -> TokenStream2 {
|
||||
match condition {
|
||||
"executable" => {
|
||||
quote!{
|
||||
std::process::Command::new(shell)
|
||||
.arg("-c")
|
||||
.arg(format!("command -v {}", #arg))
|
||||
.output()
|
||||
.expect("failed to execute process")
|
||||
.status
|
||||
.success()
|
||||
}
|
||||
},
|
||||
"executable" => quote!{check_executable(shell, #arg)},
|
||||
"err_contains" => quote!{error_msg.contains(#arg)},
|
||||
"cmd_contains" => quote!{last_command.contains(#arg)},
|
||||
_ => unreachable!("Unknown condition when evaluation condition: {}", condition),
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue