File tree Expand file tree Collapse file tree 2 files changed +9
-8
lines changed
Expand file tree Collapse file tree 2 files changed +9
-8
lines changed Original file line number Diff line number Diff line change @@ -30,8 +30,9 @@ func DeterminePath(choice string) (string, error) {
3030 return fullPath , nil
3131 }
3232
33- if tmux .IsSession (fullPath ) {
34- return fullPath , nil
33+ isSession , sessionPath := tmux .IsSession (fullPath )
34+ if isSession && sessionPath != "" {
35+ return sessionPath , nil
3536 }
3637
3738 zoxideResult , err := zoxide .Query (fullPath )
Original file line number Diff line number Diff line change @@ -36,18 +36,18 @@ func isAttached() bool {
3636 return len (os .Getenv ("TMUX" )) > 0
3737}
3838
39- func IsSession (session string ) bool {
39+ func IsSession (session string ) ( bool , string ) {
4040 sessions , err := List ()
4141 if err != nil {
42- return false
42+ return false , ""
4343 }
4444
4545 for _ , s := range sessions {
4646 if s .Name == session {
47- return true
47+ return true , s . Path
4848 }
4949 }
50- return false
50+ return false , ""
5151}
5252
5353func attachSession (session string ) error {
@@ -83,11 +83,11 @@ func NewSession(s TmuxSession) (string, error) {
8383}
8484
8585func Connect (s TmuxSession , alwaysSwitch bool , command string ) error {
86- isSession := IsSession (s .Name )
86+ isSession , _ := IsSession (s .Name )
8787 if ! isSession {
8888 _ , err := NewSession (s )
8989 if err != nil {
90- fmt .Errorf ("unable to connect to tmux session %q: %w" , s .Name , err )
90+ return fmt .Errorf ("unable to connect to tmux session %q: %w" , s .Name , err )
9191 }
9292 if command != "" {
9393 runPersistentCommand (s .Name , command )
You can’t perform that action at this time.
0 commit comments