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
- 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) MoveEvery() time.Duration
- func (b *Board) OpenOn(ctx context.Context, ref pullrequests.Reference) error
- 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 Repos
- type Row
- type Snapshot
Constants ¶
const View = "pull-requests"
View is the board's one tab, the name --view takes.
Variables ¶
This section is empty.
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, 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. 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) 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) 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. 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.
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 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.