summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorCanop <cano.petrole@gmail.com>2023-12-02 09:54:39 +0100
committerCanop <cano.petrole@gmail.com>2023-12-02 09:54:39 +0100
commit10f2a195be376983696e220cb8a8053c97adbe27 (patch)
treeb0eb6c88b3663d3f10ba15876d07bb86751d9c1e
parent870f840f880922bccf038474650f5a637f42cc49 (diff)
more tilde expansion in verb arguments
-rw-r--r--CHANGELOG.md1
-rw-r--r--resources/default-conf/verbs.hjson2
-rw-r--r--src/verb/exec_pattern.rs9
3 files changed, 11 insertions, 1 deletions
diff --git a/CHANGELOG.md b/CHANGELOG.md
index 0216fde..0ca33b8 100644
--- a/CHANGELOG.md
+++ b/CHANGELOG.md
@@ -2,6 +2,7 @@
- `:trash` internal - I'd like feedback on this one - Fix #799
- solve symlinks on `:panel_right` to display the dest path and the dest filesystem - Fix #804
- `:panel_right` on a directory now removes the filter
+- more '~' expansion in verb arguments
### v1.29.0 - 2023-11-22
<a name="v1.29.0"></a>
diff --git a/resources/default-conf/verbs.hjson b/resources/default-conf/verbs.hjson
index 2191040..a7a9c78 100644
--- a/resources/default-conf/verbs.hjson
+++ b/resources/default-conf/verbs.hjson
@@ -81,7 +81,7 @@ verbs: [
# trash, you may use the ':trash' internal with the verb below:
# {
# invocation: "rm"
- # internal: "trash {file}"
+ # internal: "trash"
# leave_broot: false
# }
diff --git a/src/verb/exec_pattern.rs b/src/verb/exec_pattern.rs
index 774df34..25b0ee2 100644
--- a/src/verb/exec_pattern.rs
+++ b/src/verb/exec_pattern.rs
@@ -1,5 +1,6 @@
use {
crate::{
+ path::*,
verb::*,
},
serde::Deserialize,
@@ -103,11 +104,19 @@ impl ExecPattern {
}
fn fix_token_path<T: Into<String> + AsRef<str>>(token: T) -> String {
+ //let s = token.as_ref();
let path = Path::new(token.as_ref());
if path.exists() {
if let Some(path) = path.to_str() {
return path.to_string();
}
+ } else if TILDE_REGEX.is_match(token.as_ref()) {
+ let path = untilde(token.as_ref());
+ if path.exists() {
+ if let Some(path) = path.to_str() {
+ return path.to_string();
+ }
+ }
}
token.into()
}