Skip to content
This repository was archived by the owner on Dec 22, 2024. It is now read-only.

Commit bcda371

Browse files
committed
If session exists, just attach to it
1 parent a9d66c2 commit bcda371

File tree

3 files changed

+6
-8
lines changed

3 files changed

+6
-8
lines changed

Diff for: Cargo.lock

+1-1
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

Diff for: Cargo.toml

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
[package]
22
name = "tm"
33
description = "tmux helper"
4-
version = "0.5.14"
4+
version = "0.6.0"
55
edition = "2021"
66
authors = ["Jörg Jaspert <[email protected]>"]
77
license = "BSD-2-Clause"

Diff for: src/main.rs

+4-6
Original file line numberDiff line numberDiff line change
@@ -580,14 +580,12 @@ impl Session {
580580
// session name like this already exists, we error
581581
// out. Could, *maybe* attach to that? Unsure. Might
582582
// be surprising.
583+
sesname = self.set_name(&line)?.to_string();
583584
if self.exists() {
584-
return Err(anyhow!(
585-
"Session name {} as read from file {:?} matches existing session, not recreating/messing with it.",
586-
line,
587-
self.sesfile
588-
));
585+
info!("Session matches existing one, attaching");
586+
self.attach()?;
587+
return Ok(());
589588
} else {
590-
sesname = self.set_name(&line)?.to_string();
591589
debug!("Calculated session name: {}", sesname);
592590
}
593591
}

0 commit comments

Comments
 (0)