tmux

package
v0.0.0-...-2f3e4b8 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Dec 26, 2015 License: GPL-3.0 Imports: 14 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	// IgnoredCmd is list of commands ignored by save session
	IgnoredCmd []string
	// DefaultCmd is a command used when the command is ignored
	DefaultCmd string
)

Functions

func BuildSession

func BuildSession(s *Session, tmux string, args []string, attach bool) error

BuildSession build a session based on Session structure

func IsInsideTmux

func IsInsideTmux() bool

IsInsideTmux Check if we are inside tmux or not

func IsSessionExists

func IsSessionExists(name string) bool

IsSessionExists check if a session name is available on tmux or not

func SaveSessionToFile

func SaveSessionToFile(sess []byte, fileName string) error

SaveSessionToFile save a session struct to a file name

Types

type Command

type Command struct {
	Parts []string
}

Command is a helper for executable command inside tmux pane

func BuildPane

func BuildPane(w *Window, tmux string, args []string, s *Session) (*Command, error)

BuildPane build a pane from a window

func (*Command) Add

func (m *Command) Add(part ...string)

Add a part to command

func (*Command) Clear

func (m *Command) Clear()

Clear the current command

func (*Command) Execute

func (m *Command) Execute(base string, args []string) (string, error)

Execute this command

func (*Command) String

func (m *Command) String() string

Convert command to string

type Pane

type Pane struct {
	Commands []string `yaml:"commands"`
	Focus    bool     `yaml:"focus,omitempty"`
	Root     string   `yaml:"root,omitempty"`
	// contains filtered or unexported fields
}

Pane handle each pane (single command line) in tmux

type Session

type Session struct {
	// This is set from command line.
	Attach  bool     `yaml:"-"`
	Name    string   `yaml:"name,omitempty"`
	Windows []Window `yaml:"windows"`
}

Session handle a tmux session, each session contain many Window

func LoadSession

func LoadSession(data []byte) (*Session, error)

LoadSession loads session from a bytes slice

func LoadSessionFromFile

func LoadSessionFromFile(fileName string) (*Session, error)

LoadSessionFromFile try to load a session from file

func LoadSessionFromTmux

func LoadSessionFromTmux(tmux string, args []string, session string) (*Session, error)

LoadSessionFromTmux fill session structure from a running instance of tmux

type Window

type Window struct {
	Name string `yaml:"name"`
	// This is some kind of incompatibility with teamocil, But I need to each pane have its own start path
	// The value from config is ignored here
	Root     string        `yaml:"root,omitempty"`
	Layout   string        `yaml:"layout"`
	Panes    []interface{} `yaml:"panes"`
	RealPane []Pane        `yaml:"-"`
}

Window handle tmux window, each window can have multiple pane. tmux has limit for pane count base window layout

func LoadWindowFromTmux

func LoadWindowFromTmux(tmux string, args []string, window, name, layout string) (*Window, error)

LoadWindowFromTmux loads window from a tmux session

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL