Help us shape the future of Go! Take the 2026 Go Developer Survey

openpr

package
v0.30.1 Latest Latest
Warning

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

Go to latest
Published: Oct 30, 2026 License: MIT Imports: 8 Imported by: 0

Documentation

Overview

Package openpr implements the pr command, which opens a branch's pull request in the default browser.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Action

func Action(ctx context.Context, deps Deps, opts Options) error

Action resolves the pull request opts identifies and opens it in the default browser.

func SetBrowserOpener

func SetBrowserOpener(fn func(url string) error)

SetBrowserOpener overrides the function Action uses to open a URL in the browser. Intended for tests; pass nil to restore the default.

Types

type Deps

type Deps struct {
	Engine Engine
	Out    output.Output
}

Deps are the collaborators the pr command needs. Adapters build them from their own runtime state; the action never sees bootstrap types.

type Engine

type Engine interface {
	CurrentBranch(ctx context.Context) *engine.Branch
	BranchNames() *engine.BranchSet
	AllBranches() engine.Branches
	GetBranch(branchName string) engine.Branch
	GetStackRootForBranch(branch engine.Branch) string
	BatchReadMetadataRaw(ctx context.Context, branchNames []string) (engine.MetaMap, map[string]error)
}

Engine lists exactly the engine methods the pr command calls.

type Options

type Options struct {
	// Target is a branch name or PR number from the command line. Empty means
	// the current branch.
	Target string
	// Stack opens the root PR of the target's stack instead of the target
	// branch's own PR.
	Stack bool
}

Options configures which pull request to open.

Jump to

Keyboard shortcuts

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