|
|
@ -245,7 +245,7 @@ async fn shell_execute(config: &GlobalConfig, shell: &Shell, mut input: Input) -
|
|
|
|
return Ok(());
|
|
|
|
return Ok(());
|
|
|
|
}
|
|
|
|
}
|
|
|
|
if *IS_STDOUT_TERMINAL {
|
|
|
|
if *IS_STDOUT_TERMINAL {
|
|
|
|
let options = ["execute", "revise", "describe", "cancel"];
|
|
|
|
let options = ["execute", "revise", "describe", "copy", "quit"];
|
|
|
|
let command = color_text(eval_str.trim(), nu_ansi_term::Color::Rgb(255, 165, 0));
|
|
|
|
let command = color_text(eval_str.trim(), nu_ansi_term::Color::Rgb(255, 165, 0));
|
|
|
|
let first_letter_color = nu_ansi_term::Color::Cyan;
|
|
|
|
let first_letter_color = nu_ansi_term::Color::Cyan;
|
|
|
|
let prompt_text = options
|
|
|
|
let prompt_text = options
|
|
|
@ -257,12 +257,14 @@ async fn shell_execute(config: &GlobalConfig, shell: &Shell, mut input: Input) -
|
|
|
|
println!("{command}");
|
|
|
|
println!("{command}");
|
|
|
|
let answer = Text::new(&format!("{prompt_text}:"))
|
|
|
|
let answer = Text::new(&format!("{prompt_text}:"))
|
|
|
|
.with_default("e")
|
|
|
|
.with_default("e")
|
|
|
|
.with_validator(|input: &str| match matches!(input, "e" | "r" | "d" | "c") {
|
|
|
|
.with_validator(
|
|
|
|
true => Ok(Validation::Valid),
|
|
|
|
|input: &str| match matches!(input, "e" | "r" | "d" | "c" | "q") {
|
|
|
|
false => Ok(Validation::Invalid(
|
|
|
|
true => Ok(Validation::Valid),
|
|
|
|
"Invalid option, choice one of e, r, d or c".into(),
|
|
|
|
false => Ok(Validation::Invalid(
|
|
|
|
)),
|
|
|
|
"Invalid option, choice one of e, r, d, c or q".into(),
|
|
|
|
})
|
|
|
|
)),
|
|
|
|
|
|
|
|
},
|
|
|
|
|
|
|
|
)
|
|
|
|
.prompt()?;
|
|
|
|
.prompt()?;
|
|
|
|
|
|
|
|
|
|
|
|
match answer.as_str() {
|
|
|
|
match answer.as_str() {
|
|
|
@ -292,6 +294,10 @@ async fn shell_execute(config: &GlobalConfig, shell: &Shell, mut input: Input) -
|
|
|
|
println!();
|
|
|
|
println!();
|
|
|
|
continue;
|
|
|
|
continue;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
"c" => {
|
|
|
|
|
|
|
|
set_text(&eval_str)?;
|
|
|
|
|
|
|
|
println!("{}", dimmed_text("✓ Copied the command"));
|
|
|
|
|
|
|
|
}
|
|
|
|
_ => {}
|
|
|
|
_ => {}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
break;
|
|
|
|
break;
|
|
|
|