Documentation
¶
Index ¶
- type AdHocOptions
- type Manager
- func (m *Manager) Create(ctx context.Context, name string, force bool) error
- func (m *Manager) CreateAdHoc(ctx context.Context, name string, session *config.Session, opts AdHocOptions) error
- func (m *Manager) CreateAdHocWindow(ctx context.Context, parentSession, windowName string, sess *config.Session) error
- func (m *Manager) CreateOrAttach(ctx context.Context, name string, force bool) error
- func (m *Manager) Kill(name string) error
- func (m *Manager) List() ([]SessionInfo, error)
- type SessionInfo
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type AdHocOptions ¶
type AdHocOptions struct {
Force bool // destroy any existing session with the same name first
Detach bool // create without attaching
Temporary bool // set destroy-unattached on the session
}
AdHocOptions tunes CreateAdHoc.
type Manager ¶
type Manager struct {
// contains filtered or unexported fields
}
Manager orchestrates session lifecycle on top of a Tmux implementation.
func NewManager ¶
NewManager wires a Manager backed by a real *tmux.Client. Returns an error if tmux is not on PATH.
func NewManagerWith ¶
NewManagerWith builds a Manager backed by the given Tmux. Used by tests.
func (*Manager) CreateAdHoc ¶
func (m *Manager) CreateAdHoc(ctx context.Context, name string, session *config.Session, opts AdHocOptions) error
CreateAdHoc creates a session from an in-memory Session definition (i.e. not loaded from the config file). The Session is validated with the same rules as configured sessions. If temporary is true, the session is set to destroy itself when the last client detaches.
func (*Manager) CreateAdHocWindow ¶
func (m *Manager) CreateAdHocWindow(ctx context.Context, parentSession, windowName string, sess *config.Session) error
CreateAdHocWindow creates a new window inside the named parent session (typically the current $TMUX session) and fills it with one pane per host. It does not change session focus — the caller is presumed to be inside the same tmux client and will see the new window appear.
func (*Manager) CreateOrAttach ¶
CreateOrAttach attaches to an existing tmux session, or builds one from the configuration and attaches. If the session name is not in the config, the caller can still attach to it as long as it already exists in tmux — this lets `mox -a foo` work for hand-rolled tmux sessions too.
On context cancellation during build the partial session is killed.
func (*Manager) List ¶
func (m *Manager) List() ([]SessionInfo, error)
List returns information about all configured sessions plus any running tmux sessions that are not in the config.
type SessionInfo ¶
SessionInfo describes a session and whether it is currently running. Managed is true if the name appears in the mox config; false if the session exists in tmux but has no config entry.