Documentation
¶
Index ¶
- Constants
- func CacheBuildProgressBar(env *Env, events chan cache.BuildEvent) error
- func CloseBackend(env *Env, runE func(cmd *cobra.Command, args []string) error) func(*cobra.Command, []string) error
- func LoadBackend(env *Env) func(*cobra.Command, []string) error
- func LoadBackendEnsureUser(env *Env) func(*cobra.Command, []string) error
- func LoadRepo(env *Env) func(*cobra.Command, []string) error
- func LoadRepoEnsureUser(env *Env) func(*cobra.Command, []string) error
- type Env
- type In
- type Out
- type TestIn
- type TestOut
- func (te *TestOut) ForceIsTerminal(value bool)
- func (te *TestOut) IsTerminal() bool
- func (te *TestOut) Print(a ...interface{})
- func (te *TestOut) PrintJSON(v interface{}) error
- func (te *TestOut) Printf(format string, a ...interface{})
- func (te *TestOut) Println(a ...interface{})
- func (te *TestOut) Raw() io.Writer
- func (te *TestOut) Width() int
Constants ¶
View Source
const RootCommandName = "git-bug"
Variables ¶
This section is empty.
Functions ¶
func CacheBuildProgressBar ¶
func CacheBuildProgressBar(env *Env, events chan cache.BuildEvent) error
func CloseBackend ¶
func CloseBackend(env *Env, runE func(cmd *cobra.Command, args []string) error) func(*cobra.Command, []string) error
CloseBackend is a wrapper for a RunE function that will close the Backend properly if it has been opened. This wrapper style is necessary because a Cobra PostE function does not run if RunE return an error.
func LoadBackend ¶
LoadBackend is a pre-run function that load the repository and the Backend for use in a command When using this function you also need to use CloseBackend as a post-run
func LoadBackendEnsureUser ¶
LoadBackendEnsureUser is the same as LoadBackend, but also ensure that the user has configured an identity. Use this pre-run function when an error after using the configured user won't do.
Types ¶
type Env ¶
type Env struct {
Repo repository.ClockedRepo
Backend *cache.RepoCache
In In
Out Out
Err Out
}
Env is the environment of a command
func NewTestEnv ¶
func NewTestEnvTerminal ¶
type In ¶
type In interface {
io.Reader
// IsTerminal tells if the input is a user terminal (rather than a buffer,
// a pipe ...), which tells if we can use interactive features.
IsTerminal() bool
// ForceIsTerminal allow to force the returned value of IsTerminal
// This only works in test scenario.
ForceIsTerminal(value bool)
}
type Out ¶
type Out interface {
io.Writer
Printf(format string, a ...interface{})
Print(a ...interface{})
Println(a ...interface{})
PrintJSON(v interface{}) error
// IsTerminal tells if the output is a user terminal (rather than a buffer,
// a pipe ...), which tells if we can use colors and other interactive features.
IsTerminal() bool
// Width return the width of the attached terminal, or a good enough value.
Width() int
// Raw return the underlying io.Writer, or itself if not.
// This is useful if something need to access the raw file descriptor.
Raw() io.Writer
// String returns what have been written in the output before, as a string.
// This only works in test scenario.
String() string
// Bytes returns what have been written in the output before, as []byte.
// This only works in test scenario.
Bytes() []byte
// Reset clear what has been recorded as written in the output before.
// This only works in test scenario.
Reset()
// ForceIsTerminal allow to force the returned value of IsTerminal
// This only works in test scenario.
ForceIsTerminal(value bool)
}
Click to show internal directories.
Click to hide internal directories.