Documentation
¶
Overview ¶
Package board is prs's view on gotermboard: every open pull request as a row, the people's above the bots', those recently closed below, each one's document beside the list or a key away, and a key per action.
Index ¶
- Constants
- Variables
- func DocumentSectionNames() string
- func MarkdownDocument(pr pullrequests.PullRequest, detail *pullrequests.DetailState, ...) string
- func Refused(window config.WindowAction) error
- type Board
- func (b *Board) Actions() []gotermboard.Action
- func (b *Board) ClosedFaults() []string
- func (b *Board) CursorOn(key string)
- func (b *Board) Frame(now time.Time, _ string) gotermboard.Frame
- func (b *Board) Gaps() []string
- func (b *Board) Groupings() []string
- func (b *Board) KeepListings(dir string)
- func (b *Board) Look(width int) gotermboard.Look
- func (b *Board) MoveEvery() time.Duration
- func (b *Board) OpenOn(ctx context.Context, ref pullrequests.Reference) error
- func (b *Board) OpenRecaps(commands config.Recaps, writeLogs string) *Recaps
- func (b *Board) OpenSummary(dir string, every time.Duration, window pullrequests.Since) *Summary
- func (b *Board) ReadClosed(since pullrequests.Since, every time.Duration)
- func (b *Board) ReadDetails()
- func (b *Board) ReadDiffs(maxLines int)
- func (b *Board) Receive(m *gotermboard.Model, msg tea.Msg) tea.Cmd
- func (b *Board) Rows(now time.Time) []Row
- func (b *Board) Snapshot(now time.Time) Snapshot
- func (b *Board) Sources() []gotermboard.Refresher
- func (b *Board) StripAt(now time.Time) []gotermboard.Line
- func (b *Board) Table(now time.Time) []gotermboard.Line
- func (b *Board) UnderWay() string
- type RecapSnapshot
- type RecapWindow
- type Recaps
- func (r *Recaps) Actions() []gotermboard.Action
- func (r *Recaps) CursorOn(key string)
- func (r *Recaps) Faults() []string
- func (r *Recaps) Frame(now time.Time, _ string) gotermboard.Frame
- func (r *Recaps) Groupings() []string
- func (r *Recaps) Look(width int) gotermboard.Look
- func (r *Recaps) MoveEvery() time.Duration
- func (r *Recaps) Receive(m *gotermboard.Model, msg tea.Msg) tea.Cmd
- func (r *Recaps) Snapshot() RecapsSnapshot
- func (r *Recaps) Sources() []gotermboard.Refresher
- func (r *Recaps) StripAt(now time.Time) []gotermboard.Line
- func (r *Recaps) UnderWay() string
- type RecapsSnapshot
- type Repos
- type Row
- type Snapshot
- type Summary
- func (s *Summary) Actions() []gotermboard.Action
- func (s *Summary) Close() error
- func (s *Summary) CountUntil(until time.Time)
- func (s *Summary) Faults() []string
- func (s *Summary) Frame(now time.Time, _ string) gotermboard.Frame
- func (s *Summary) Groupings() []string
- func (s *Summary) Look(width int) gotermboard.Look
- func (s *Summary) MoveEvery() time.Duration
- func (s *Summary) Notes(now time.Time) []string
- func (s *Summary) Numbers(now time.Time) summary.Numbers
- func (s *Summary) Snapshot(now time.Time) SummarySnapshot
- func (s *Summary) Sources() []gotermboard.Refresher
- func (s *Summary) StripAt(now time.Time) []gotermboard.Line
- func (s *Summary) Table(now time.Time) []gotermboard.Line
- func (s *Summary) Window() pullrequests.Since
- type SummaryCache
- type SummarySnapshot
Constants ¶
const DefaultSummaryWindow = "30d"
const RecapsView = "recaps"
RecapsView is the Recaps tab's name, the name --view takes.
const SummaryView = "summary"
SummaryView is the Summary tab's name, the name --view takes.
const View = "pull-requests"
View is the board's one tab, the name --view takes.
Variables ¶
var SummaryWindows = []string{"1d", "7d", "2w", "30d", "90d"}
SummaryWindows are the windows w and W step the Summary tab between, shortest first, and DefaultSummaryWindow the one it opens on.
Functions ¶
func DocumentSectionNames ¶ added in v0.7.0
func DocumentSectionNames() string
DocumentSectionNames is every section's heading, lowercased and joined as prose joins a list.
func MarkdownDocument ¶ added in v0.7.0
func MarkdownDocument(pr pullrequests.PullRequest, detail *pullrequests.DetailState, diff *pullrequests.DiffState, roundWindow string, now time.Time) string
MarkdownDocument is the pull request as one markdown document: a line naming it, then a level-1 heading per section. Description is the listing's body, so it is whole at once. The sections the detail read fills say they are reading until it lands, and so does Diff until its own read does. A nil detail is a host that reads none, whose document has no detail section, and a nil diff leaves Diff out, as beside d's diff in nvim. roundWindow is the open tmux window running a review round on it, and empty where none is. now is what each age counts from. The title is not in it, since every place it shows names the title already.
func Refused ¶
func Refused(window config.WindowAction) error
Refused says why a window action cannot have its key, and is nil where the key is free. A board's key sits ahead of the table's, so a window action on a bound key would take it. esc backs out of whatever is open, which no table action names.
Types ¶
type Board ¶
type Board struct {
// contains filtered or unexported fields
}
Board is the open pull requests of the repos a registry names, read from each provider that hosts one, and those recently merged or closed.
func New ¶
New is a board over repos, reading each provider every interval, with the window actions the config adds. It refuses a window action on a key the board already binds.
func (*Board) Actions ¶
func (b *Board) Actions() []gotermboard.Action
Actions is gotermboard.Keyed's. The board's keys sit ahead of the table's, so the footer and the ? overlay list them first.
func (*Board) ClosedFaults ¶ added in v0.8.0
ClosedFaults names each read of the recently closed whose newest attempt failed, with why. A full page is not one, because the read sorts the newest first so a page keeps them.
func (*Board) Frame ¶
Frame is gotermboard.Board's: the people's open pull requests, then the bots', then those merged or closed within the window, each a group whose header counts it and folds it. The merged or closed pull request the board opened on sits in a group of its own above them.
func (*Board) Gaps ¶ added in v0.4.0
Gaps names each read of the open pull requests, or of the one the board opened on, whose newest attempt failed, or that read and noted pull requests it left out, with why. A note leaves rows out as a failure does, so both count.
func (*Board) KeepListings ¶ added in v0.6.0
KeepListings has the board draw the listings the last run on these repos kept in dir until each provider's first read lands, and keep each listing that lands there for the next run. A board printed once leaves it off, since it waits for its reads.
func (*Board) Look ¶ added in v0.13.0
func (b *Board) Look(width int) gotermboard.Look
Look is gotermboard.LookBoard's: a margin around the screen, the columns spread across the width, rules under the titles and above the keys, and the cursor's pull request bold on the selection. The margin gives way to the side panel, which gotermboard measures inside it, so a screen wide enough for the panel keeps it. Every row opens its document, so no row draws a chevron.
func (*Board) MoveEvery ¶ added in v0.6.0
MoveEvery is gotermboard.MovingBoard's. The strip turns its spinner while a read runs and holds still otherwise, so a read never grows the footer and takes a row's line.
func (*Board) OpenOn ¶ added in v0.5.0
OpenOn reads the pull request ref names, for the board to start with the cursor on it and its document open. OpenOn refuses one it cannot read, so the refusal comes before anything draws.
While a listing holds it, it is that listing's row. Otherwise its own read draws it: an open one among the listing's rows, and a merged or closed one in a group above them. That read runs on the board's timer, so a pull request merged elsewhere, or on a repo the board does not read, moves as it does.
func (*Board) OpenRecaps ¶ added in v0.16.0
OpenRecaps is the Recaps tab, running commands, with each write's output in a file under writeLogs. A board that reads detail reads every listed window's recap once the list lands, and one that reads none, as a printed one, only the recap it draws.
func (*Board) OpenSummary ¶ added in v0.15.0
OpenSummary is the Summary tab over the board's repos, counting window, with the merged and closed pull requests kept in a file under dir for the repos read, and read again every interval. With no dir, or a file that cannot be opened, it keeps them in memory, so each start reads the window whole. Close closes the file.
func (*Board) ReadClosed ¶ added in v0.8.0
func (b *Board) ReadClosed(since pullrequests.Since, every time.Duration)
ReadClosed has the board read, every interval, the pull requests merged or closed within since, from each provider whose client can say when one closed, for the recently closed group. prs list leaves it off, because it prints the open pull requests only.
func (*Board) ReadDetails ¶ added in v0.4.0
func (b *Board) ReadDetails()
ReadDetails has each listing that lands read its rows' details in the background, for the document's sections that detail fills and each row's review round. Inside tmux it also has the board read which windows are open, where a window action runs a review round. A board printed once leaves it off, since nothing waits for them.
func (*Board) ReadDiffs ¶ added in v0.10.0
ReadDiffs has each listing that lands read its rows' diffs in the background, for the document's Diff section, which shows one whole up to maxLines changed lines. A diff is read in the repo's checkout, fetched as d fetches it, and from GitHub where the repo is not checked out. A board printed once leaves it off, since nothing waits for them.
func (*Board) Receive ¶ added in v0.3.0
Receive is gotermboard.ReceivingBoard's. Each provider is read again when the terminal gains focus and when a program prs handed the terminal to exits, because either is someone coming back to the list, maybe from changing a pull request. The model runs a handback's then after this.
func (*Board) Rows ¶ added in v0.4.0
Rows is every pull request the listings hold, in the order the board draws them, and empty rather than nil, so no rows print as [].
func (*Board) Sources ¶
func (b *Board) Sources() []gotermboard.Refresher
Sources is gotermboard.Board's.
func (*Board) StripAt ¶ added in v0.6.0
func (b *Board) StripAt(now time.Time) []gotermboard.Line
StripAt is gotermboard.MovingBoard's: how each read stands, with a spinner after the rows' age while a read runs, and why the listing cache could not be read or written, until a write succeeds.
type RecapSnapshot ¶ added in v0.16.0
type RecapSnapshot struct {
RecapWindow
Recap *string `json:"recap"`
Fault string `json:"fault,omitempty"`
}
RecapSnapshot is one window, its recap as show printed it, null where none was read, and why the newest read failed.
type RecapWindow ¶ added in v0.16.0
RecapWindow is one window the list command printed: its kind, such as day, and its label, such as 2026-11-06. prs reads nothing else of what the commands print.
func (RecapWindow) String ¶ added in v0.16.0
func (w RecapWindow) String() string
type Recaps ¶ added in v0.16.0
type Recaps struct {
// contains filtered or unexported fields
}
Recaps is the Recaps tab: the windows the config's list command prints, in its order, and the recap its show command prints for each, as a markdown document beside the list. Its write command writes a window's recap with a model call, on w after asking. prs runs the three as argv and reads nothing of what they print but the list's kind and label.
func (*Recaps) Actions ¶ added in v0.16.0
func (r *Recaps) Actions() []gotermboard.Action
Actions is gotermboard.Keyed's: w writes a recap, where the config names a write command.
func (*Recaps) CursorOn ¶ added in v0.16.0
CursorOn is gotermboard.CursorBoard's. A cursor landing on a window whose recap is due reads it on the next tick, ahead of the rest.
func (*Recaps) Faults ¶ added in v0.16.0
Faults name the list's failure, the lines it printed that were not a window, and each recap read that failed, so a printed tab exits 1 where it misses one.
func (*Recaps) Frame ¶ added in v0.16.0
Frame is gotermboard.Board's: the windows in the list's order, each opening its recap.
func (*Recaps) Look ¶ added in v0.16.0
func (r *Recaps) Look(width int) gotermboard.Look
Look is gotermboard.LookBoard's: the board's own, so the margin holds still across tabs, with the columns kept together, since two short ones spread across the width read apart.
func (*Recaps) MoveEvery ¶ added in v0.16.0
MoveEvery is gotermboard.MovingBoard's. The strip turns its spinner while a read runs.
func (*Recaps) Receive ¶ added in v0.16.0
Receive is gotermboard.ReceivingBoard's. A write ending runs the list again, which reads every recap again with it, so a window written for the first time joins the list.
func (*Recaps) Snapshot ¶ added in v0.16.0
func (r *Recaps) Snapshot() RecapsSnapshot
Snapshot reads what the tab holds now.
func (*Recaps) Sources ¶ added in v0.16.0
func (r *Recaps) Sources() []gotermboard.Refresher
Sources is gotermboard.Board's: the list, then the recaps it names.
type RecapsSnapshot ¶ added in v0.16.0
type RecapsSnapshot struct {
View string `json:"view"`
Windows []RecapSnapshot `json:"windows"`
Sources []gotermboard.Status `json:"sources"`
}
RecapsSnapshot is what prs tui --view recaps --json prints: each window the list named, in its order, with the recap read for it, and how each read stands. cmd/prs/recaps.schema.json is its shape.
type Repos ¶ added in v0.4.0
Repos is what the board reads: the repos the registry at Registry names, or with no registry, Owners whole. From is the config layer that chose, one of config's From constants.
type Row ¶ added in v0.4.0
type Row struct {
pullrequests.PullRequest
StackedOn *int `json:"stacked_on"`
}
Row is one pull request as both --json outputs print it, with the open pull request it is stacked on where there is one. cmd/prs/list.schema.json is its shape.
type Snapshot ¶
type Snapshot struct {
View string `json:"view"`
Registry string `json:"registry"`
Owners []string `json:"owners,omitempty"`
PullRequests []Row `json:"pull_requests"`
RecentlyClosed []Row `json:"recently_closed"`
OpenedOn *Row `json:"opened_on"`
Sources []gotermboard.Status `json:"sources"`
}
Snapshot is what --json prints: the rows the board draws, and how each read stands. PullRequests is the open ones, as prs list --json prints them, and RecentlyClosed those merged or closed within --since, newest first, each a row of the same shape. Registry is empty where the board reads owners whole, and Owners names them, with @me for the token's own account. OpenedOn is the pull request --pr named, which may be merged or closed, and null without one.
type Summary ¶ added in v0.15.0
type Summary struct {
// contains filtered or unexported fields
}
Summary is the Summary tab: the pull requests opened, merged and closed within a window, in numbers and charts. The open pull requests are the board's own listings, read on the board's timer whichever tab shows, and the merged and closed are GitHub's, kept in a store and read again every closed refresh.
func (*Summary) Actions ¶ added in v0.15.0
func (s *Summary) Actions() []gotermboard.Action
Actions is gotermboard.Keyed's: w and W step the window.
func (*Summary) CountUntil ¶ added in v0.15.0
CountUntil has the tab count up to until rather than now, for prs summary --until.
func (*Summary) Faults ¶ added in v0.15.0
Faults name each read whose newest attempt failed, or that left open pull requests out, so prs summary exits 1 where its counts miss something.
func (*Summary) Frame ¶ added in v0.15.0
Frame is gotermboard.Board's: the strip, the charts, then the counts and each repo's merges.
func (*Summary) Look ¶ added in v0.15.0
func (s *Summary) Look(width int) gotermboard.Look
Look is gotermboard.LookBoard's, the board's own, so the margin holds still across tabs.
func (*Summary) MoveEvery ¶ added in v0.15.0
MoveEvery is gotermboard.MovingBoard's. The strip turns its spinner while a read runs.
func (*Summary) Notes ¶ added in v0.15.0
Notes say what the counts leave out: a window older than the store reaches, merged and closed pull requests no read says, and a host whose closed pull requests are not read.
func (*Summary) Snapshot ¶ added in v0.15.0
func (s *Summary) Snapshot(now time.Time) SummarySnapshot
Snapshot reads what the tab holds now.
func (*Summary) Sources ¶ added in v0.15.0
func (s *Summary) Sources() []gotermboard.Refresher
Sources is gotermboard.Board's: the board's open listings, then the history.
func (*Summary) StripAt ¶ added in v0.15.0
func (s *Summary) StripAt(now time.Time) []gotermboard.Line
StripAt is gotermboard.MovingBoard's: the windows with the one counted lit, how each read stands, and what the counts leave out.
func (*Summary) Table ¶ added in v0.15.0
func (s *Summary) Table(now time.Time) []gotermboard.Line
Table is what prs summary prints: the strip's lines, then each group's rows under its title, the counts aligned in the tab's columns.
func (*Summary) Window ¶ added in v0.15.0
func (s *Summary) Window() pullrequests.Since
Window is the window the tab counts.
type SummaryCache ¶ added in v0.15.0
SummaryCache is the store's file, empty where it is kept in memory, and its coverage.
type SummarySnapshot ¶ added in v0.15.0
type SummarySnapshot struct {
View string `json:"view"`
Registry string `json:"registry"`
Owners []string `json:"owners,omitempty"`
summary.Numbers
// Cache is where the merged and closed pull requests are kept and how far they reach, and
// null where nothing has been read into it.
Cache *SummaryCache `json:"cache"`
Notes []string `json:"notes"`
Sources []gotermboard.Status `json:"sources"`
}
SummarySnapshot is what prs summary --json prints: the numbers, flattened, then what they were counted from. cmd/prs/summary.schema.json is its shape.