joshmedeski / sesh

Smart session manager for the terminal
MIT License
410 stars 16 forks source link

Support to create sessions from SSH config #90

Closed enthusiva closed 1 month ago

enthusiva commented 3 months ago

I would like sesh also list down the SSH hosts configured in the ssh config so that I can directly create tmux sessions for SSH connections. As of now, I create empty directories for each ssh server so that sesh lists those directories for me to pick from and use startup scripts to ssh into the servers based on the empty directory path.

I really enjoy sesh a lot and it helps to speed up my dev workflow. Thank you for making this great tool.

joshmedeski commented 3 months ago

Can you clarify what happens when you select a configured SSH host. Would it create a local tmux session and run a ssh connect command?

I believe you'll be able to set this up with #86 when I ship that feature. If it's too limiting for you I can revisit this issue.

enthusiva commented 3 months ago

you are right. It will create local session and the startup script will run the ssh command to connect to the server. I will check session config feature once it is released.

enthusiva commented 2 months ago

@joshmedeski I migrated to the latest version of sesh recently. It seems that the path attribute should be specified for all sessions in the config. Otherwise, it executes the startup command for the first session for any session defined in the sesh.toml file. For ex, in the below config, when I tried to run session for server2 or server3, sesh always executes the startup command for server1.

[[session]]
name = "server1"
startup_command = "ssh server1"

[[session]]
name = "server2"
startup_command = "ssh server2"

[[session]]
name = "server3"
startup_command = "ssh server3"

If I specify the path attribute for all these sessions, it works perfectly. I am unable to conclude whether it is by design or bug. It would be better if sesh can implicitly use the home directory as default path if the path attribute is not specified for a session.


ps: sorry. I just noticed that a similar issue has already been reported. I will wait until next release.

joshmedeski commented 2 months ago

Every tmux session is associated with a directory, wether you use it or not.

I recommend setting it to something (anything, I guess in your case it won't matter.)

Furthermore, if you set new windows or panes on that session it will start at the root directory.

joshmedeski commented 1 month ago

Closing this issue since it appears to be dealt with using the config feature.