Documentation
¶
Overview ¶
Package config reads prs's config file, which names the registry of repos or the owners read in its place, how often the board reads them, how large a diff a pull request's document shows whole, and the keys a person adds to it.
Index ¶
- Constants
- func ClosedPullRequestsDir() (string, error)
- func DefaultRegistry() (string, error)
- func Fill(template string, fields Fields) string
- func ListingCacheDir() (string, error)
- func MissingPrograms(programs []string) []string
- func Path() (string, error)
- func Placeholders() []string
- type Config
- type Fields
- type WindowAction
Constants ¶
const ( FromVariable = RegistryVariable FromFile = "repos_registry in the config file" FromOwners = "owners in the config file" FromDefault = "the default" FromViewer = "no registry at the default, so your own repos on GitHub" )
Which layer chose the repos prs reads, in the order they are asked.
const DefaultClosedRefreshEvery = 5 * time.Minute
DefaultClosedRefreshEvery is how often the board reads the recently closed pull requests, and the Summary tab its history, where the file does not say. Each read costs GitHub about as much as the open one, and what it finds changes only when a pull request closes, which the open read already shows.
const DefaultDiffSectionMaxLines = 300
DefaultDiffSectionMaxLines is DiffSectionMaxLines where the file does not say: about three screens of the side panel, past which nvim's diff, with its file tree, reads faster than scrolling.
const DefaultRefreshEvery = time.Minute
DefaultRefreshEvery is how often the board reads each provider while it is open, where the file does not say. Each GitHub read spends points from the token's hourly GraphQL allowance.
const RegistryVariable = "PRS_REPOS_REGISTRY"
RegistryVariable names the registry for one shell, ahead of the config file.
Variables ¶
This section is empty.
Functions ¶
func ClosedPullRequestsDir ¶ added in v0.15.0
ClosedPullRequestsDir is where the Summary tab and prs summary keep the merged and closed pull requests they count, a SQLite file for each set of repos: closed-pull-requests under $XDG_CACHE_HOME/prs, or ~/.cache/prs where that is unset.
func DefaultRegistry ¶
DefaultRegistry is where prs looks for the registry when nothing names one: repos.json under $XDG_DATA_HOME, or ~/.local/share where that is unset.
func ListingCacheDir ¶ added in v0.6.0
ListingCacheDir is where the board keeps each provider's last listing, a file for each set of repos it reads, so the next start draws it before any read returns: listings under $XDG_CACHE_HOME/prs, or ~/.cache/prs where that is unset.
func MissingPrograms ¶
MissingPrograms is those of programs that are not on PATH.
Types ¶
type Config ¶
type Config struct {
// File is the path read, whether or not anything was there.
File string
// Exists says the file was there to read.
Exists bool
// Registry is the repo registry's path. Where it is empty, prs reads Owners whole, and
// with no Owners either, the repos the GitHub token's own account holds. ReposFrom is
// the layer that chose.
Registry string
Owners []string
ReposFrom string
// RefreshEvery is how often the board reads each provider again while it is open, and
// RefreshFrom names the layer that set it.
RefreshEvery time.Duration
RefreshFrom string
// ClosedRefreshEvery is how often the board reads the recently closed pull requests
// again, and the Summary tab what changed in the history it counts from.
// ClosedRefreshFrom names the layer that set it.
ClosedRefreshEvery time.Duration
ClosedRefreshFrom string
// DiffSectionMaxLines is the most lines a pull request may change for its document's Diff
// section to show its diff whole. A larger one's section names its size instead.
// DiffSectionFrom names the layer that set it.
DiffSectionMaxLines int
DiffSectionFrom string
// WindowActions are the keys the file adds, each opening a tmux window on a pull request.
WindowActions []WindowAction
}
Config is what the environment and the file say, with each path expanded.
type WindowAction ¶
type WindowAction struct {
Key string `yaml:"key"`
Label string `yaml:"label"`
Detail string `yaml:"detail"`
// Needs are the programs the command runs, checked before the window opens, because
// tmux reports a window opened even when its command cannot start.
Needs []string `yaml:"needs"`
// Providers limits the key to pull requests these providers host. Empty means any.
Providers []string `yaml:"providers"`
// Window is the tmux window's name, and Command the shell command it runs. Both take
// the names Placeholders lists.
Window string `yaml:"window"`
Command string `yaml:"command"`
// RunsReviewRound says the command runs a Claude review round on the pull request, so the
// row reads the round as running while the window is open and the round has not finished.
RunsReviewRound bool `yaml:"runs_review_round"`
}
WindowAction is a key that runs a command in a new tmux window, started in the pull request's checkout. It is offered only where every program it needs is on PATH.
func (WindowAction) Missing ¶
func (a WindowAction) Missing() []string
Missing is the programs the action needs that are not on PATH. The board offers its key only where none is.