-
Notifications
You must be signed in to change notification settings - Fork 203
feat: add two more tmux session mode #1359
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
Conversation
| 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)?; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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)?; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
| 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; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Why not move this to L192?
| # - "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) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
only if isn't in another one
Either grammatically incorrect or extremely hard to read. Please reword these comments
| AttachIfNotInSession, | ||
| AttachAlways, | ||
| ReattachIfNotInSession, | ||
| ReattachAlways, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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.
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.