Documentation
¶
Overview ¶
Package tui is jt's interactive terminal UI, built on Bubble Tea v2.
Index ¶
- Variables
- func IssueTypes() []*jira.IssueType
- func Run(b Backend, opts Options) error
- func SaveQuery(name, jql string) error
- func SearchJQL(sess Session, input string) string
- func SetTheme(name string) error
- type App
- type Backend
- type Hint
- type ListSpec
- type Options
- type Popup
- type Session
- type View
Constants ¶
This section is empty.
Variables ¶
var BuiltinListNames = []string{"issues", "mine", "sprint", "backlog", "recent", "watching", "reported", "epics", "bugs", "updated"}
BuiltinListNames are the list commands offered in completion and help.
Functions ¶
func IssueTypes ¶
IssueTypes are the active project's issue types from the config.
Types ¶
type App ¶
type App struct {
// contains filtered or unexported fields
}
App is the root Bubble Tea model: a stack of views, an optional floating popup, and a status bar.
type Backend ¶
type Backend interface {
Search(jql string, from, limit uint) (*jira.SearchResult, error)
Issue(key string) (*jira.Issue, error)
FavouriteFilters() ([]*jira.SavedFilter, error)
Transitions(key string) ([]*jira.Transition, error)
Transition(key string, t *jira.Transition) error
AssignableUsers(project, query string) ([]*jira.User, error)
// Assign sets the assignee by username; jira.AssigneeNone unassigns.
Assign(key, username string) error
Comment(key, markdown string) error
Worklog(key, timeSpent, comment string) error
Edit(key string, req *jira.EditRequest) error
Create(req *jira.CreateRequest) (*jira.CreateResponse, error)
Watch(key, username string, watch bool) error
LinkTypes() ([]*jira.IssueLinkType, error)
Link(inward, outward, linkType string) error
Delete(key string) error
Board(boardID int) (*jira.BoardConfig, error)
// Sprints lists sprints in the given comma separated states.
Sprints(boardID int, states string) ([]*jira.Sprint, error)
SprintIssues(sprintID int, jql string) (*jira.SearchResult, error)
BoardIssues(boardID int, jql string) (*jira.SearchResult, error)
MoveToSprint(sprintID int, keys []string) error
MoveToBacklog(keys []string) error
Rank(keys []string, before, after string) error
}
Backend is the slice of the Jira API the TUI needs. It is an interface so the UI can be driven by a fake in tests.
func NewJiraBackend ¶
NewJiraBackend wraps a configured Jira client.
type ListSpec ¶
ListSpec describes an issue list view: a title and the JQL behind it.
func BuiltinList ¶
BuiltinList returns the spec for a built-in list name, or false.
func EpicChildren ¶
EpicChildren lists the issues of an epic (Jira DC "Epic Link").
type Options ¶
type Options struct {
// Start is a ":" command to run first (e.g. "mine" or "DATA-12").
Start string
// Search opens the floating search with this input on startup.
Search string
// contains filtered or unexported fields
}
Options configure how the TUI starts.
func (Options) WithSearch ¶
WithSearch opens the floating search with input on startup.
type Popup ¶
type Popup interface {
Update(msg tea.Msg) (Popup, tea.Cmd)
// Render returns the framed window sized for a screen of width x height.
Render(st styles, width, height int) string
}
Popup is a floating window. While open it receives every key.
type Session ¶
type Session struct {
Server string
Login string
Name string // saved project name (current_project)
Project string
BoardID int
Projects []jtConfig.SavedProject
Queries map[string]string // saved_queries from config
Theme string
// WatchInterval polls watched/assigned issues for changes (0 disables).
WatchInterval time.Duration
// Bell rings the terminal bell on watch notifications.
Bell bool
}
Session is the user-facing state that survives view changes: who we are, which server, and which saved project is active.
func LoadSession ¶
func LoadSession() Session
LoadSession snapshots the current viper state (after the project overlay).
func SwitchProject ¶
SwitchProject persists name as the current project, re-applies it to viper and returns the refreshed session.
func (Session) ProjectClause ¶
ProjectClause scopes a query to the active project, if any.
type View ¶
type View interface {
Init() tea.Cmd
Update(msg tea.Msg) (View, tea.Cmd)
Render(width, height int) string
Title() string
// Hints are the view's own keys, shown in the footer and in help.
Hints() []Hint
// Capturing is true while the view owns the keyboard (e.g. inline
// filter input), so global keys are not intercepted.
Capturing() bool
// Selected is the issue under the cursor, if any; global issue actions
// (open, copy, branch) act on it.
Selected() *jira.Issue
// Marked are the issues selected in visual mode; actions apply to all
// of them when non-empty.
Marked() []*jira.Issue
}
View is one screen on the view stack (issue list, issue detail, ...).