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 v.io/jiri/tool.<key> <value>" v.io/jiri/<tool>
2) It provides the Context type, which encapsulates the state and abstractions commonly accessed throughout the lifetime of a tool invocation.
Index ¶
- Variables
- func InitializeProjectFlags(flags *flag.FlagSet)
- func InitializeRunFlags(flags *flag.FlagSet)
- type Context
- func (ctx Context) Clone(opts ContextOpts) *Context
- func (ctx Context) Color() bool
- func (ctx Context) Env() map[string]string
- func (ctx Context) Gerrit(host *url.URL) *gerrit.Gerrit
- func (ctx Context) Jenkins(host string) (*jenkins.Jenkins, error)
- func (ctx Context) Manifest() string
- func (ctx Context) NewSeq() runutil.Sequence
- 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)
- func (ctx Context) Verbose() bool
- type ContextOpts
Constants ¶
This section is empty.
Variables ¶
var ( // Flags for running commands. ColorFlag bool VerboseFlag bool // Flags for working with projects. ManifestFlag string )
var Name string = ""
Name identifies the name of a tool.
var Version string = "manual-build"
Version identifies the version of a tool.
Functions ¶
func InitializeProjectFlags ¶
InitializeRunFlags initializes flags for working with projects.
func InitializeRunFlags ¶
InitializeRunFlags initializes flags for running commands.
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.
func (Context) Jenkins ¶
Jenkins returns a new Jenkins instance that can be used to communicate with a Jenkins server running at the given host.
func (Context) NewSeq ¶
NewSeq returns a new instance of Sequence initialized using the options stored in the context.
func (Context) TimerPop ¶
func (ctx Context) TimerPop()
TimerPop calls ctx.Timer().Pop(), only if the Timer is non-nil.