Documentation ¶
Index ¶
- func ExecCmd(args []string) error
- func GetAttachedSessionName() (string, error)
- func InTravis() bool
- func IsInsideTmux() bool
- func RunCmd(args []string) (string, string, error)
- type Configuration
- type Pane
- type Server
- func (s *Server) AddSession(session Session)
- func (s *Server) HasSession(name string) (bool, error)
- func (s *Server) KillSession(name string) error
- func (s *Server) ListPanes() ([]Pane, error)
- func (s *Server) ListSessions() ([]Session, error)
- func (s *Server) NewSession(name string) (session Session, err error)
- type Session
- type Window
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func GetAttachedSessionName ¶
Returns a name of the attached tmux session.
Types ¶
type Configuration ¶
type Configuration struct { Server *Server // Pointer to used tmux server Sessions []*Session // List of sessions to be initialized ActiveSession *Session // Session to be attached after initialization. }
func (*Configuration) Apply ¶
func (c *Configuration) Apply() error
Apply given configuration to setup a user-defined workflow Before running this method, user must make sure that there is no windows and session with same names exists. Otherwise existing sessions/windows will be replaced with the new ones.
type Pane ¶
type Pane struct { ID int SessionId int SessionName string WindowId int WindowName string WindowIndex int Active bool }
Represent a tmux pane: https://github.com/tmux/tmux/wiki/Getting-Started#sessions-windows-and-panes
func ListPanes ¶
Return a list of panes. Optional arguments are define the search scope with tmux command keys (see tmux(1) manpage):
list-panes [-as] [-F format] [-t target]
- `-a`: target is ignored and all panes on the server are listed
- `-s`: target is a session. If neither is given, target is a window (or the current window).
func NewPane ¶
func NewPane(id int, sessionId int, sessionName string, windowId int, windowName string, windowIndex int, active bool) *Pane
Creates a new pane object.
func (*Pane) GetCurrentPath ¶
Returns current path for this pane.
func (*Pane) RunCommand ¶
RunCommand runs a command in the pane.
type Server ¶
type Server struct { SocketPath string // Path to tmux server socket SocketName string // Name of created tmux socket Sessions []Session // List of sessions used on server initialization }
Represents a tmux server: https://github.com/tmux/tmux/wiki/Getting-Started#the-tmux-server-and-clients
func (*Server) AddSession ¶
Add session to server configuration. This will change only in-library server representation. Used for initial configuration before creating new server.
func (*Server) HasSession ¶
Return true that session with given name is exsits on this server, false otherwise.
func (*Server) KillSession ¶
Kills session with given name. If killed session not found, KillSession will not raise error and just do nothing.
func (*Server) ListSessions ¶
Lists all sessions managed by this server.
func (*Server) NewSession ¶
Create new session with given name on this server.
Session always will be detached after creation. Call AttachSession to attach it. If session already exists, this function return an error. Check session with HaveSession before running it if you need it.
type Session ¶
type Session struct { Id int // Session id Name string // Session name StartDirectory string // Path to window start directory Windows []Window // List of windows used on session initialization }
Represents a tmux session: https://github.com/tmux/tmux/wiki/Getting-Started#sessions-windows-and-panes
func NewSession ¶
Creates a new session object.
func (*Session) AddWindow ¶
Adds the window to the session configuration. This will change only in-library session representation. Used for initial configuration before creating a new session.
func (*Session) AttachSession ¶
Attach to existing tmux session.
func (*Session) DettachSession ¶
Detaches from the current session. Detaching from the tmux session means that the client exits and detaches from the outside terminal. See: https://github.com/tmux/tmux/wiki/Getting-Started#attaching-and-detaching
func (*Session) ListWindows ¶
Lists all windows in the current session.
type Window ¶
type Window struct { Name string Id int SessionId int SessionName string StartDirectory string // Path to window working directory Panes []Pane // List of panes used in initial window configuration }
Represents a tmux window: https://github.com/tmux/tmux/wiki/Getting-Started#sessions-windows-and-panes
func NewWindow ¶
func NewWindow(id int, name string, sessionId int, sessionName string, startDirectory string, panes []Pane) *Window
Creates a new window object.