diff options
| author | Ken Matsui <26405363+ken-matsui@users.noreply.github.com> | 2021-11-08 09:12:31 +0900 |
|---|---|---|
| committer | Ken Matsui <26405363+ken-matsui@users.noreply.github.com> | 2021-11-11 13:14:59 +0900 |
| commit | 00b47b3058b6adc6f4e17651ea6b73f81435b8b6 (patch) | |
| tree | dcdb215a04077d925107a4c6bd83b3f6039457d7 /src | |
| parent | fix(ci): release with stable toolchain (diff) | |
| download | sl0ppij-00b47b3058b6adc6f4e17651ea6b73f81435b8b6.tar.gz sl0ppij-00b47b3058b6adc6f4e17651ea6b73f81435b8b6.tar.xz sl0ppij-00b47b3058b6adc6f4e17651ea6b73f81435b8b6.zip | |
feat(sessions): Suggestion for a similar session name
Remove unnecessary to_string
Replace `garando_syntax` crate with `lev_distance` which is much smaller
Replace `lev_distance` crate with `suggestion` to simplify the code
Diffstat (limited to 'src')
| -rw-r--r-- | src/sessions.rs | 4 |
1 files changed, 4 insertions, 0 deletions
diff --git a/src/sessions.rs b/src/sessions.rs index bf44d088..4d2fe5fb 100644 --- a/src/sessions.rs +++ b/src/sessions.rs @@ -1,6 +1,7 @@ use std::os::unix::fs::FileTypeExt; use std::time::SystemTime; use std::{fs, io, process}; +use suggestion::Suggest; use zellij_utils::{ consts::ZELLIJ_SOCK_DIR, interprocess::local_socket::LocalSocketStream, @@ -177,6 +178,9 @@ pub(crate) fn assert_session(name: &str) { return; } else { println!("No session named {:?} found.", name); + if let Some(sugg) = get_sessions().unwrap().suggest(name) { + println!(" help: Did you mean `{}`?", sugg); + } } } Err(e) => { |
