feat: add two more tmux session mode#1359
Open
rafaScalet wants to merge 4 commits intotopgrade-rs:mainfrom
Open
feat: add two more tmux session mode#1359rafaScalet wants to merge 4 commits intotopgrade-rs:mainfrom
rafaScalet wants to merge 4 commits intotopgrade-rs:mainfrom
Conversation
GideonBear
requested changes
Oct 7, 2025
| let session_name = "topgrade"; | ||
| let window_name = "topgrade"; | ||
| let session = tmux.new_unique_session(session_name, window_name, &command)?; | ||
| // let session = tmux.new_unique_session(session_name, window_name, &command)?; |
Member
There was a problem hiding this comment.
Please remove commented-out code
| let is_inside_tmux = env::var("TMUX").is_ok(); | ||
| let err = match config.session_mode { | ||
| TmuxSessionMode::AttachIfNotInSession => { | ||
| session = tmux.new_unique_session(session_name, window_name, &command)?; |
Member
There was a problem hiding this comment.
Suggested change
| session = tmux.new_unique_session(session_name, window_name, &command)?; | |
| let session = tmux.new_unique_session(session_name, window_name, &command)?; |
| let window_name = "topgrade"; | ||
| let session = tmux.new_unique_session(session_name, window_name, &command)?; | ||
| // let session = tmux.new_unique_session(session_name, window_name, &command)?; | ||
| let session: String; |
Comment on lines
+65
to
+68
| # - "attach_if_not_in_session" create and attach in a new unique session, only if isn't in another one | ||
| # - "attach_always" create and attach in a new unique session, even if in another one | ||
| # - "reattach_if_not_in_session" reuse or create a new session, and attach to if isn't in another one | ||
| # - "reattach_always" reuse or create a new session, and attach to, even if in another one) |
Member
There was a problem hiding this comment.
only if isn't in another one
Either grammatically incorrect or extremely hard to read. Please reword these comments
Comment on lines
355
to
+358
| AttachIfNotInSession, | ||
| AttachAlways, | ||
| ReattachIfNotInSession, | ||
| ReattachAlways, |
Member
There was a problem hiding this comment.
Instead of expanding this enum, could you make a new tmux_reattach: bool (or a different name if you like)? This would also remove the duplication that is currently in the match block.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
What does this PR do
Close #1337
Add two more session mode,
ReattachAlwaysandReattachIfNotInSession.These two modes, are similar to
AttachAlwaysandAttachIfNotInSession, except they won't create a new session if one already exists.Standards checklist
CONTRIBUTING.mdFor new steps
--dry-runoption works with this step--yesoption works with this step if it is supported bythe underlying command
If you developed a feature or a bug fix for someone else and you do not have the
means to test it, please tag this person here.