Documentation ¶
Index ¶
- type RepoName
- type State
- func (st *State) MaybeFindRepository(ctx context.Context, workUnitName string) (api.Repository, error)
- func (st *State) NewSession(ctx context.Context, repo api.Repository, workUnitName string) (tmux.Session, error)
- func (st *State) PruneSessions(ctx context.Context) error
- func (st *State) RenameSession(ctx context.Context, repo api.Repository, old, new string) error
- func (st *State) Repositories() map[RepoName]api.Repository
- func (st *State) Session(repo api.Repository, workUnitName string) tmux.Session
- func (st *State) SessionName(n WorkUnitName) string
- func (st *State) Sessions() map[WorkUnitName]tmux.Session
- func (st *State) UnknownSessions() map[string]tmux.Session
- func (st *State) WorkUnit(ctx context.Context, sesh tmux.Session) (api.Repository, string, error)
- type WorkUnitName
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type RepoName ¶
type RepoName struct {
VCS, Repo string
}
func NewRepoName ¶
func NewRepoName(repo api.Repository) RepoName
type State ¶
type State struct {
// contains filtered or unexported fields
}
func (*State) MaybeFindRepository ¶
func (st *State) MaybeFindRepository(ctx context.Context, workUnitName string) (api.Repository, error)
MaybeFindRepository attempts to find an api.Repository that's currently active in tmux and claims that the given work unit exists. Returns an error if multiple api.Repositories claim that the given work unit exists. Returns nil, nil if no such api.Repository exists.
func (*State) NewSession ¶
func (st *State) NewSession(ctx context.Context, repo api.Repository, workUnitName string) (tmux.Session, error)
NewSession creates a tmux session for the given work unit. Returns an error if the session already exists.
func (*State) RenameSession ¶
RenameSession finds a tmux session for work unit old and then renames that session so that it represents work unit new. Returns an error if the "old" tmux session doesn't exist or if there's already a "new" tmux session.
func (*State) Repositories ¶
func (st *State) Repositories() map[RepoName]api.Repository
Repositories returns a representative example for each known RepoName.
func (*State) SessionName ¶
func (st *State) SessionName(n WorkUnitName) string
SessionName returns the string that this State would use for the tmux session name if a work unit with the given name were created right now.
func (*State) Sessions ¶
func (st *State) Sessions() map[WorkUnitName]tmux.Session
Sessions returns all tmux sessions keyed by their work unit.
func (*State) UnknownSessions ¶
UnknownSessions returns all tmux sessions that didn't appear to have a work unit.
type WorkUnitName ¶
func NewWorkUnitName ¶
func NewWorkUnitName(repo api.Repository, workUnitName string) WorkUnitName
func ParseSessionName ¶
func ParseSessionName(repo api.Repository, tmuxSessionName string) WorkUnitName
func (WorkUnitName) LogValue ¶
func (n WorkUnitName) LogValue() slog.Value
func (WorkUnitName) RepoString ¶
func (n WorkUnitName) RepoString() string
func (WorkUnitName) WorkUnitString ¶
func (n WorkUnitName) WorkUnitString() string