mirror of
https://github.com/sxyazi/yazi.git
synced 2026-07-25 08:41:05 +00:00
feat: add confirm arg
This commit is contained in:
parent
8f7c8ffbfb
commit
085c003b1b
2 changed files with 6 additions and 3 deletions
|
|
@ -108,6 +108,7 @@ impl Executor {
|
|||
"rename" => cx.manager.rename(),
|
||||
"shell" => cx.manager.shell(
|
||||
exec.named.contains_key("block"),
|
||||
exec.named.contains_key("confirm"),
|
||||
exec.args.get(0).map(|s| s.as_str()).unwrap_or(""),
|
||||
),
|
||||
"hidden" => cx.manager.current_mut().hidden(match exec.args.get(0).map(|s| s.as_str()) {
|
||||
|
|
|
|||
|
|
@ -225,12 +225,14 @@ impl Manager {
|
|||
|
||||
pub fn bulk_rename(&self) -> bool { false }
|
||||
|
||||
pub fn shell(&self, block: bool, arg: &str) -> bool {
|
||||
pub fn shell(&self, block: bool, confirm: bool, arg: &str) -> bool {
|
||||
let mut command = arg.to_string();
|
||||
|
||||
tokio::spawn(async move {
|
||||
if command.is_empty() {
|
||||
let result = emit!(Input(InputOpt::top("Shell:").with_highlight()));
|
||||
if confirm || command.is_empty() {
|
||||
let opt = InputOpt::top("Shell:").with_value(command.as_str()).with_highlight();
|
||||
let result = emit!(Input(opt));
|
||||
|
||||
if let Ok(exec) = result.await {
|
||||
command = exec;
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue