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 ¶
func ResolveVersion ¶ added in v0.3.0
ResolveVersion returns version, or the module version recorded by `go install` when version wasn't set at build time.
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
// FromRelease is set for prebuilt release binaries, as opposed to
// builds made with `go install`; it decides how triage updates itself.
FromRelease bool
}
Env is everything a command needs; tests substitute their own.
func NewEnv ¶ added in v0.2.0
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
NewTestEnv builds an environment around a fake GitHub client.
func (*Env) ParseIssueRef ¶ added in v0.2.0
ParseIssueRef parses "12", "#12", "repo#12", or "owner/repo#12".
func (*Env) RequireClient ¶ added in v0.2.0
RequireClient returns a friendly error when GitHub isn't reachable.
func (*Env) ResolveRepo ¶ added in v0.2.0
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
SaveConfig writes the config and rebuilds the engine around it.