diff options
author | Canop <cano.petrole@gmail.com> | 2023-12-02 09:54:39 +0100 |
---|---|---|
committer | Canop <cano.petrole@gmail.com> | 2023-12-02 09:54:39 +0100 |
commit | 10f2a195be376983696e220cb8a8053c97adbe27 (patch) | |
tree | b0eb6c88b3663d3f10ba15876d07bb86751d9c1e /src | |
parent | 870f840f880922bccf038474650f5a637f42cc49 (diff) |
more tilde expansion in verb arguments
Diffstat (limited to 'src')
-rw-r--r-- | src/verb/exec_pattern.rs | 9 |
1 files changed, 9 insertions, 0 deletions
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() } |