mirror of
https://github.com/sxyazi/yazi.git
synced 2026-07-25 08:41:05 +00:00
feat: allow opening interactively with the --chosen-file flag (#920)
Co-authored-by: sxyazi <sxyazi@gmail.com>
This commit is contained in:
parent
9e75ed5c71
commit
1d15fd96c5
1 changed files with 4 additions and 3 deletions
|
|
@ -9,6 +9,7 @@ use yazi_shared::{emit, event::{Cmd, EventQuit}, fs::{File, Url}, MIME_DIR};
|
||||||
|
|
||||||
use crate::{folder::Folder, manager::Manager, tasks::Tasks};
|
use crate::{folder::Folder, manager::Manager, tasks::Tasks};
|
||||||
|
|
||||||
|
#[derive(Clone, Copy)]
|
||||||
pub struct Opt {
|
pub struct Opt {
|
||||||
interactive: bool,
|
interactive: bool,
|
||||||
hovered: bool,
|
hovered: bool,
|
||||||
|
|
@ -36,7 +37,7 @@ impl Manager {
|
||||||
let selected =
|
let selected =
|
||||||
if opt.hovered { vec![&hovered] } else { self.selected_or_hovered(true).collect() };
|
if opt.hovered { vec![&hovered] } else { self.selected_or_hovered(true).collect() };
|
||||||
|
|
||||||
if Self::quit_with_selected(&selected) {
|
if Self::quit_with_selected(opt, &selected) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -122,8 +123,8 @@ impl Manager {
|
||||||
|| find(self.active().history.get(&p))
|
|| find(self.active().history.get(&p))
|
||||||
}
|
}
|
||||||
|
|
||||||
fn quit_with_selected(selected: &[&Url]) -> bool {
|
fn quit_with_selected(opt: Opt, selected: &[&Url]) -> bool {
|
||||||
if ARGS.chooser_file.is_none() {
|
if opt.interactive || ARGS.chooser_file.is_none() {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Add table
Reference in a new issue