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 set_environment(self, key: &str, value: &str) -> Self
pub fn set_environment(self, key: &str, value: &str) -> Self
Set a session-level environment variable.
The resulting tmux set-environment -t <session> <key> <value> command
is emitted before any send-keys commands so all panes inherit it.
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.
Trait Implementations§
Auto Trait Implementations§
impl Freeze for TmuxSessionBuilder
impl RefUnwindSafe for TmuxSessionBuilder
impl Send for TmuxSessionBuilder
impl Sync for TmuxSessionBuilder
impl Unpin for TmuxSessionBuilder
impl UnsafeUnpin for TmuxSessionBuilder
impl UnwindSafe for TmuxSessionBuilder
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Source§impl<T> Instrument for T
impl<T> Instrument for T
Source§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
Source§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read more