app

package
v0.2.0 Latest Latest
Warning

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

Go to latest
Published: Oct 9, 2026 License: MIT Imports: 12 Imported by: 0

Documentation

Overview

Package app holds the environment shared by triage's command line and interactive app.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Env added in v0.2.0

type Env struct {
	Paths        config.Paths
	Config       config.Config
	ConfigExists bool
	// ConfigErr is a problem found while loading config.toml.
	ConfigErr error

	Client *gh.Client
	// ClientErr explains why Client is nil.
	ClientErr error
	Engine    *engine.Engine

	In       io.Reader
	Out, Err io.Writer
	// IsTerminal reports whether stdout is a terminal.
	IsTerminal bool

	// CurrentRepo returns the GitHub repo of the working directory.
	CurrentRepo func() (string, error)
	// OpenURL opens a URL in the browser.
	OpenURL func(string) error
	// Version is the build version.
	Version string
}

Env is everything a command needs; tests substitute their own.

func NewEnv added in v0.2.0

func NewEnv(version string) (*Env, error)

NewEnv builds the real environment. It never fails outright: missing auth or a broken config are recorded so commands can explain them.

func NewTestEnv added in v0.2.0

func NewTestEnv(paths config.Paths, client *gh.Client, out, errOut io.Writer) *Env

NewTestEnv builds an environment around a fake GitHub client.

func (*Env) ParseIssueRef added in v0.2.0

func (env *Env) ParseIssueRef(ref string) (string, int, error)

ParseIssueRef parses "12", "#12", "repo#12", or "owner/repo#12".

func (*Env) RequireClient added in v0.2.0

func (env *Env) RequireClient() error

RequireClient returns a friendly error when GitHub isn't reachable.

func (*Env) ResolveRepo added in v0.2.0

func (env *Env) ResolveRepo(input string) (string, error)

ResolveRepo turns user input into an owner/name repo. Input may be a full reference or just a name that matches one tracked repo. Empty input falls back to the current directory's repo, then default_repo, then the only tracked repo.

func (*Env) SaveConfig added in v0.2.0

func (env *Env) SaveConfig() error

SaveConfig writes the config and rebuilds the engine around it.

func (*Env) SetClient added in v0.2.0

func (env *Env) SetClient(client *gh.Client)

SetClient replaces the GitHub client, e.g. after the user signs in.

Jump to

Keyboard shortcuts

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