Skip to content

Commit

Permalink
Implement tab completion for ~/ (#164)
Browse files Browse the repository at this point in the history
* Implement tab completion for ~/

Fixes #87.

* Fix clippy
  • Loading branch information
certik authored Sep 27, 2024
1 parent d6c4841 commit 2283331
Showing 1 changed file with 3 additions and 0 deletions.
3 changes: 3 additions & 0 deletions crates/shell/src/completion.rs
Original file line number Diff line number Diff line change
Expand Up @@ -62,6 +62,9 @@ fn complete_filenames(_is_start: bool, word: &str, matches: &mut Vec<Pair>) {
// Determine the full directory path to search
let search_dir = if dir_path.starts_with('/') {
dir_path.to_string()
} else if let Some(stripped) = dir_path.strip_prefix('~') {
let home_dir = dirs::home_dir().unwrap();
format!("{}{}", home_dir.display(), stripped)
} else {
format!("./{}", dir_path)
};
Expand Down

0 comments on commit 2283331

Please sign in to comment.