aboutsummaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorKen Matsui <26405363+ken-matsui@users.noreply.github.com>2021-11-08 09:12:31 +0900
committerKen Matsui <26405363+ken-matsui@users.noreply.github.com>2021-11-11 13:14:59 +0900
commit00b47b3058b6adc6f4e17651ea6b73f81435b8b6 (patch)
treedcdb215a04077d925107a4c6bd83b3f6039457d7 /src
parentfix(ci): release with stable toolchain (diff)
downloadsl0ppij-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.rs4
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) => {