Documentation ¶
Overview ¶
Package tool contains abstractions for working with developer tools. In particular:
1) It contains global variables that can be used to store attributes of a tool. Automated builds can set these values to something meaningful as follows:
go build -ldflags "-X github.com/btwiuse/jiri/tool.<key> <value>" github.com/btwiuse/jiri/<tool>
2) It provides the Context type, which encapsulates the state and abstractions commonly accessed throughout the lifetime of a tool invocation.
Index ¶
- type Context
- func (ctx Context) Clone(opts ContextOpts) *Context
- func (ctx Context) Env() map[string]string
- func (ctx Context) Stderr() io.Writer
- func (ctx Context) Stdin() io.Reader
- func (ctx Context) Stdout() io.Writer
- func (ctx Context) Timer() *timing.Timer
- func (ctx Context) TimerPop()
- func (ctx Context) TimerPush(name string)
- type ContextOpts
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Context ¶
type Context struct {
// contains filtered or unexported fields
}
Context represents an execution context of a tool command invocation. Its purpose is to enable sharing of state throughout the lifetime of a command invocation.
func NewContextFromEnv ¶
NewContextFromEnv returns a new context instance based on the given cmdline environment.
func NewDefaultContext ¶
func NewDefaultContext() *Context
NewDefaultContext returns a new default context.
func (Context) Clone ¶
func (ctx Context) Clone(opts ContextOpts) *Context
Clone creates a clone of the given context, overriding select settings using the given options.