diff --git a/flake.lock b/flake.lock index e6849c45..fccdab32 100644 --- a/flake.lock +++ b/flake.lock @@ -5,11 +5,11 @@ "systems": "systems" }, "locked": { - "lastModified": 1694529238, - "narHash": "sha256-zsNZZGTGnMOf9YpHKJqMSsa0dXbfmxeoJ7xHlrt+xmY=", + "lastModified": 1701680307, + "narHash": "sha256-kAuep2h5ajznlPMD9rnQyffWG8EM/C73lejGofXvdM8=", "owner": "numtide", "repo": "flake-utils", - "rev": "ff7b65b44d01cf9ba6a71320833626af21126384", + "rev": "4022d587cbbfd70fe950c1e2083a02621806a725", "type": "github" }, "original": { @@ -20,11 +20,11 @@ }, "nixpkgs": { "locked": { - "lastModified": 1701174899, - "narHash": "sha256-1W+FMe8mWsJKXoBc+QgKmEeRj33kTFnPq7XCjU+bfnA=", + "lastModified": 1704161960, + "narHash": "sha256-QGua89Pmq+FBAro8NriTuoO/wNaUtugt29/qqA8zeeM=", "owner": "NixOS", "repo": "nixpkgs", - "rev": "010c7296f3b19a58b206fdf7d68d75a5b0a09e9e", + "rev": "63143ac2c9186be6d9da6035fa22620018c85932", "type": "github" }, "original": { @@ -51,11 +51,11 @@ ] }, "locked": { - "lastModified": 1701224160, - "narHash": "sha256-qnMmxNMKmd6Soel0cfauyMJ+LzuZbvmiDQPSIuTbQ+M=", + "lastModified": 1704507282, + "narHash": "sha256-PDfS8fj40mm2QWpbd/aiocgwcI/WHzqLKERRJkoEvXU=", "owner": "oxalica", "repo": "rust-overlay", - "rev": "4a080e26d55eaedb95ab1bf8eeaeb84149c10f12", + "rev": "a127cccf7943beae944953963ba118d643299c3b", "type": "github" }, "original": { diff --git a/nix/shell.nix b/nix/shell.nix index 42d6ddf8..090f7e97 100644 --- a/nix/shell.nix +++ b/nix/shell.nix @@ -5,6 +5,7 @@ pkgs.mkShell { rustToolchain rust-analyzer + nodejs_20 nodePackages.cspell file diff --git a/yazi-config/src/boot/args.rs b/yazi-config/src/boot/args.rs index ccfb65c3..b7798218 100644 --- a/yazi-config/src/boot/args.rs +++ b/yazi-config/src/boot/args.rs @@ -15,9 +15,6 @@ pub struct Args { /// Write the selected files on open emitted by the chooser mode #[arg(long)] pub chooser_file: Option, - /// Write the selected files on open to stdout - #[arg(long, action)] - pub chooser_stdout: bool, /// Clear the cache directory #[arg(long, action)] diff --git a/yazi-core/src/manager/commands/open.rs b/yazi-core/src/manager/commands/open.rs index c5ec3b11..0792df55 100644 --- a/yazi-core/src/manager/commands/open.rs +++ b/yazi-core/src/manager/commands/open.rs @@ -107,10 +107,6 @@ impl Manager { quit_actions.push(QuitAction::SelectToFile(paths.clone())); }; - if ARGS.chooser_stdout { - quit_actions.push(QuitAction::SelectToStdout(paths.clone())); - }; - if quit_actions.len() > 1 { tokio::spawn(async move { emit!(Quit(quit_actions)); diff --git a/yazi-core/src/select/commands/show.rs b/yazi-core/src/select/commands/show.rs index cf491dc8..d817df5e 100644 --- a/yazi-core/src/select/commands/show.rs +++ b/yazi-core/src/select/commands/show.rs @@ -20,7 +20,7 @@ impl Select { pub async fn _show(cfg: SelectCfg) -> Result { let (tx, rx) = oneshot::channel(); emit!(Call(Exec::call("show", vec![]).with_data(Opt { cfg, tx }).vec(), Layer::Select)); - rx.await.unwrap_or_else(|_| Term::goodbye(|| false, None)) + rx.await.unwrap_or_else(|_| Term::goodbye(|| false)) } pub fn show(&mut self, opt: impl TryInto) { diff --git a/yazi-fm/src/app/commands/quit.rs b/yazi-fm/src/app/commands/quit.rs index bce1d819..dfb1e533 100644 --- a/yazi-fm/src/app/commands/quit.rs +++ b/yazi-fm/src/app/commands/quit.rs @@ -9,22 +9,18 @@ use crate::app::App; impl App { pub(crate) fn quit(&mut self, quit_actions: Vec) -> Result<()> { if quit_actions.contains(&QuitAction::None) { - Term::goodbye(|| false, None) + Term::goodbye(|| false) } - let mut stdout = None; for quit_action in quit_actions { match quit_action { QuitAction::None => unreachable!(), QuitAction::CwdToFile => self.cwd_to_file(), QuitAction::SelectToFile(selected) => self.select_to_file(selected), - QuitAction::SelectToStdout(selected) => { - stdout = Some(selected.as_encoded_bytes().to_owned()) - } } } - Term::goodbye(|| false, stdout.as_deref()); + Term::goodbye(|| false); } fn cwd_to_file(&self) { diff --git a/yazi-fm/src/panic.rs b/yazi-fm/src/panic.rs index 5de13bcb..f0773886 100644 --- a/yazi-fm/src/panic.rs +++ b/yazi-fm/src/panic.rs @@ -8,13 +8,10 @@ impl Panic { let hook = std::panic::take_hook(); std::panic::set_hook(Box::new(move |info| { - Term::goodbye( - || { - hook(info); - true - }, - None, - ); + Term::goodbye(|| { + hook(info); + true + }); })); } } diff --git a/yazi-shared/src/event/event.rs b/yazi-shared/src/event/event.rs index 01ffa430..f8c73af5 100644 --- a/yazi-shared/src/event/event.rs +++ b/yazi-shared/src/event/event.rs @@ -23,7 +23,6 @@ pub enum QuitAction { None, CwdToFile, SelectToFile(OsString), - SelectToStdout(OsString), } impl Event { @@ -35,7 +34,7 @@ impl Event { pub async fn wait(self, rx: oneshot::Receiver) -> T { TX.send(self).ok(); - rx.await.unwrap_or_else(|_| Term::goodbye(|| false, None)) + rx.await.unwrap_or_else(|_| Term::goodbye(|| false)) } } diff --git a/yazi-shared/src/term/term.rs b/yazi-shared/src/term/term.rs index 40694e6f..55124f39 100644 --- a/yazi-shared/src/term/term.rs +++ b/yazi-shared/src/term/term.rs @@ -49,7 +49,7 @@ impl Term { Ok(disable_raw_mode()?) } - pub fn goodbye(f: impl FnOnce() -> bool, last_words: Option<&[u8]>) -> ! { + pub fn goodbye(f: impl FnOnce() -> bool) -> ! { execute!( stdout(), PopKeyboardEnhancementFlags, @@ -63,10 +63,6 @@ impl Term { disable_raw_mode().ok(); - if let Some(words) = last_words { - std::io::stdout().write_all(words).ok(); - } - std::process::exit(f() as i32); }