From 2e63774882130f2f26588c319dd4839dd5365007 Mon Sep 17 00:00:00 2001 From: Dominic Gerhauser Date: Sun, 17 Mar 2024 03:03:49 +0100 Subject: [PATCH] add trash flag --- src/app.rs | 14 +++++++++----- 1 file changed, 9 insertions(+), 5 deletions(-) diff --git a/src/app.rs b/src/app.rs index a695ef0..ee8052e 100644 --- a/src/app.rs +++ b/src/app.rs @@ -668,11 +668,15 @@ impl Application for App { let mut commands = Vec::new(); for arg in env::args().skip(1) { - let location = match fs::canonicalize(&arg) { - Ok(absolute) => Location::Path(absolute), - Err(err) => { - log::warn!("failed to canonicalize {:?}: {}", arg, err); - continue; + let location = if &arg == "--trash" { + Location::Trash + } else { + match fs::canonicalize(&arg) { + Ok(absolute) => Location::Path(absolute), + Err(err) => { + log::warn!("failed to canonicalize {:?}: {}", arg, err); + continue; + } } }; commands.push(app.open_tab(location));