summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorKunal Mohan <kunalmohan99@gmail.com>2021-05-19 21:17:21 +0530
committerKunal Mohan <kunalmohan99@gmail.com>2021-05-22 22:19:50 +0530
commit2487256664d4142ee1906f0058cf7e8063cb6e10 (patch)
treed295a93da8ba4657194623f1e1ef2ab4d0686a03 /src
parentd231d28d7cdf7df1f44268627f5630edb19b21a0 (diff)
Mark current session in the output of list-sessions
Diffstat (limited to 'src')
-rw-r--r--src/main.rs9
1 files changed, 8 insertions, 1 deletions
diff --git a/src/main.rs b/src/main.rs
index 122747b65..e4651fd1f 100644
--- a/src/main.rs
+++ b/src/main.rs
@@ -58,10 +58,17 @@ fn list_sessions() {
match fs::read_dir(&*ZELLIJ_SOCK_DIR) {
Ok(files) => {
let mut is_empty = true;
+ let session_name = std::env::var("ZELLIJ_SESSION_NAME").unwrap_or("".into());
files.for_each(|file| {
let file = file.unwrap();
if file.file_type().unwrap().is_socket() {
- println!("{}", file.file_name().into_string().unwrap());
+ let fname = file.file_name().into_string().unwrap();
+ let suffix = if session_name == fname {
+ " (current)"
+ } else {
+ ""
+ };
+ println!("{}{}", fname, suffix);
is_empty = false;
}
});