Skip to content

Commit

Permalink
more tilde expansion in verb arguments
Browse files Browse the repository at this point in the history
  • Loading branch information
Canop committed Dec 2, 2023
1 parent 870f840 commit 10f2a19
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 1 deletion.
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -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>
Expand Down
2 changes: 1 addition & 1 deletion resources/default-conf/verbs.hjson
Original file line number Diff line number Diff line change
Expand Up @@ -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
# }

Expand Down
9 changes: 9 additions & 0 deletions src/verb/exec_pattern.rs
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
use {
crate::{
path::*,
verb::*,
},
serde::Deserialize,
Expand Down Expand Up @@ -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()
}
Expand Down

0 comments on commit 10f2a19

Please sign in to comment.