pub struct TmuxSessionBuilder { /* private fields */ }Expand description
Builder that accumulates tmux operations for creating and configuring a session.
Can either execute operations against a live tmux server or return them as command strings for testing and dry-run.
§Examples
use git_paw::tmux::{TmuxSessionBuilder, PaneSpec};
let session = TmuxSessionBuilder::new("my-project")
.add_pane(PaneSpec {
branch: "feat/auth".into(),
worktree: "/tmp/my-project-feat-auth".into(),
cli_command: "claude".into(),
})
.mouse_mode(true)
.build()?;
// Dry-run: inspect commands
for cmd in session.command_strings() {
println!("{cmd}");
}
// Or execute for real
session.execute()?;Implementations§
Source§impl TmuxSessionBuilder
impl TmuxSessionBuilder
Sourcepub fn new(project_name: &str) -> Self
pub fn new(project_name: &str) -> Self
Create a new builder for the given project name.
The session will be named paw-<project_name> unless overridden
with session_name.
Sourcepub fn session_name(self, name: String) -> Self
pub fn session_name(self, name: String) -> Self
Override the session name instead of deriving it from the project name.
Use this with resolve_session_name to handle name collisions.
Sourcepub fn add_pane(self, spec: PaneSpec) -> Self
pub fn add_pane(self, spec: PaneSpec) -> Self
Add a pane that will cd into the worktree and run the CLI command.
Sourcepub fn mouse_mode(self, enabled: bool) -> Self
pub fn mouse_mode(self, enabled: bool) -> Self
Enable or disable mouse mode for the session (default: true).
When enabled, users can click to switch panes, drag borders to resize, and scroll. This is set per-session and does not affect other tmux sessions.
Sourcepub fn build(self) -> Result<TmuxSession, PawError>
pub fn build(self) -> Result<TmuxSession, PawError>
Build the full sequence of tmux commands without executing anything.
Returns a TmuxSession that can be executed or inspected.
Returns an error if no panes have been added.