From 648e6e54bc65026e6d7f7ca90f724a712456f5b8 Mon Sep 17 00:00:00 2001 From: fcd Date: Thu, 5 Jan 2023 23:04:27 +0300 Subject: [PATCH] check if output is aborted --- Cargo.toml | 2 +- src/main.rs | 9 +++++---- 2 files changed, 6 insertions(+), 5 deletions(-) diff --git a/Cargo.toml b/Cargo.toml index 6c7a1ae..f513b82 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "leth" -version = "0.4.1" +version = "0.5.0" authors = ["fcd "] edition = "2018" diff --git a/src/main.rs b/src/main.rs index 927ccea..d97a997 100644 --- a/src/main.rs +++ b/src/main.rs @@ -54,11 +54,12 @@ pub fn main() { let item_reader = SkimItemReader::default(); let items = item_reader.of_bufread(Cursor::new(items)); - let selected_items = Skim::run_with(&options, Some(items)) - .map(|out| out.selected_items) - .unwrap_or_else(|| Vec::new()); + let output = Skim::run_with(&options, Some(items)).unwrap(); + if output.is_abort { + return; + } - for item in selected_items.iter() { + for item in output.selected_items.iter() { let url = item.clone(); Command::new("firefox") .arg(url.output().as_ref())