diff options
author | Matthew Blode <m@blode.co> | 2021-01-20 09:56:29 +1100 |
---|---|---|
committer | Matthew Blode <m@blode.co> | 2021-01-20 09:56:29 +1100 |
commit | 0eae92bc7038219247ebb72de324933372f26213 (patch) | |
tree | 9fd782a6121cdab63a2554fbc0040f9feac57890 /src/commands | |
parent | f07eee4abb6fec4cb57b535143720763c9e0848b (diff) |
cd with tilde expansion
Diffstat (limited to 'src/commands')
-rw-r--r-- | src/commands/key_command.rs | 7 |
1 files changed, 6 insertions, 1 deletions
diff --git a/src/commands/key_command.rs b/src/commands/key_command.rs index 3bdb57d..73257fa 100644 --- a/src/commands/key_command.rs +++ b/src/commands/key_command.rs @@ -8,6 +8,8 @@ use crate::util::load_child::LoadChild; use crate::util::sort::SortType; use crate::HOME_DIR; +use dirs_next::home_dir; +use shellexpand::tilde_with_context; use super::*; @@ -136,7 +138,10 @@ impl KeyCommand { )), }, ".." => Ok(Self::ParentDirectory), - arg => Ok(Self::ChangeDirectory(path::PathBuf::from(arg))), + arg => Ok({ + let path_accepts_tilde = tilde_with_context(arg, home_dir); + Self::ChangeDirectory(path::PathBuf::from(path_accepts_tilde.as_ref())) + }), }, "close_tab" => Ok(Self::CloseTab), "copy_files" => Ok(Self::CopyFiles), |