config

package
v0.7.0 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Nov 8, 2026 License: MIT Imports: 15 Imported by: 0 modules, 0 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

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, and the keys a person adds to it.

Index

Constants

View Source
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.

View Source
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.

View Source
const RegistryVariable = "PRS_REPOS_REGISTRY"

RegistryVariable names the registry for one shell, ahead of the config file.

Variables

This section is empty.

Functions

func DefaultRegistry

func DefaultRegistry() (string, error)

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 Fill

func Fill(template string, fields Fields) string

Fill puts a pull request's fields into a Window or Command.

func ListingCacheDir added in v0.6.0

func ListingCacheDir() (string, error)

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

func MissingPrograms(programs []string) []string

MissingPrograms is those of programs that are not on PATH.

func Path

func Path() (string, error)

Path is the config file's path under $XDG_CONFIG_HOME, or ~/.config where that is unset.

func Placeholders

func Placeholders() []string

Placeholders are the names Fill fills, sorted.

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
	// 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.

func Load

func Load() (Config, error)

Load reads the config file and resolves the registry. A file that is not there is no error, and says nothing.

type Fields

type Fields struct {
	Number int
	Repo   string
	Slug   string
}

Fields are what a window action's Window and Command can name of a pull request.

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"`
}

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.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL