Documentation
¶
Overview ¶
Package cmdutil provides helper utilities and interfaces for working with command line tools
Index ¶
- func FormatDuration(d time.Duration) string
- func FormatPhase(phase string) string
- func ParseVersion(in string) (string, error)
- func Watch(ctx context.Context, id string, wf WatchFunc) error
- type Codec
- type Color
- type Dashboard
- func (d *Dashboard) Done(idx int)
- func (d *Dashboard) DoneMsg(idx int, msg string)
- func (d *Dashboard) Fail(idx int)
- func (d *Dashboard) FailAfter(idx int, after time.Duration)
- func (d *Dashboard) FailAfterMsg(idx int, after time.Duration, msg string)
- func (d *Dashboard) FailMsg(idx int, msg string)
- func (d *Dashboard) IsDone() bool
- func (d *Dashboard) Loop(ctx context.Context)
- func (d *Dashboard) Update(idx int, fn func(s *ServiceState))
- func (d *Dashboard) Wait()
- func (d *Dashboard) WaitAnd(fn func())
- type Deserializer
- type JSONCodec
- type JSONDeserializer
- type JSONSerializer
- type NewSpinnerOpt
- type OutputFormat
- type Serializer
- type ServiceState
- type Spinner
- type StopFunc
- type SyncWriter
- type TableSerializer
- type WatchFunc
- type YamlCodec
- type YamlDeserializer
- type YamlSerializer
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func FormatDuration ¶
func FormatPhase ¶
func ParseVersion ¶
ParseVersion parses the provided string and ensures that it is a valid. Allowed values are either semver (prefixed with v), "latest" and "head". Case is ignored. If the version is valid, this function will resolv the version to a GitHub release name to ensure that the release exists.
Types ¶
type Codec ¶
type Codec interface {
Serializer
Deserializer
}
func NewJSONCodec ¶
func NewJSONCodec() Codec
func NewYamlCodec ¶
func NewYamlCodec() Codec
type Dashboard ¶
type Dashboard struct {
// contains filtered or unexported fields
}
Dashboard holds all services + rendering logic
func NewDashboard ¶
NewDashboard creates the dashboard with one ServiceState per name.
func (*Dashboard) FailAfterMsg ¶
func (*Dashboard) Update ¶
func (d *Dashboard) Update(idx int, fn func(s *ServiceState))
Update lets workers mutate a single service under lock.
type Deserializer ¶
func DeserializerFor ¶
func DeserializerFor(s string) (Deserializer, error)
type JSONCodec ¶
type JSONCodec struct {
*JSONSerializer
*JSONDeserializer
}
type JSONDeserializer ¶
type JSONDeserializer struct{}
func (*JSONDeserializer) Deserialize ¶
func (d *JSONDeserializer) Deserialize(b []byte, m proto.Message) error
type JSONSerializer ¶
type JSONSerializer struct{}
type NewSpinnerOpt ¶
type NewSpinnerOpt func(*Spinner)
func WithPrefix ¶
func WithPrefix(str string) NewSpinnerOpt
func WithWriter ¶
func WithWriter(w io.Writer) NewSpinnerOpt
type OutputFormat ¶
type OutputFormat string
var ( OutputFormatJSON OutputFormat = "json" OutputFormatYAML OutputFormat = "yaml" OutputFormatTable OutputFormat = "table" )
type Serializer ¶
func SerializerFor ¶
func SerializerFor(s string) (Serializer, error)
type ServiceState ¶
type ServiceState struct {
Name string
Text string
Color Color
Done bool
Failed bool
// contains filtered or unexported fields
}
ServiceState represents One line in the dashboard
type Spinner ¶
type Spinner struct {
// contains filtered or unexported fields
}
func NewSpinner ¶
func NewSpinner(opts ...NewSpinnerOpt) *Spinner
type SyncWriter ¶
type SyncWriter struct {
// contains filtered or unexported fields
}
type TableSerializer ¶
type TableSerializer struct{}
type YamlCodec ¶
type YamlCodec struct {
*YamlSerializer
*YamlDeserializer
}
type YamlDeserializer ¶
type YamlDeserializer struct{}
func (*YamlDeserializer) Deserialize ¶
func (d *YamlDeserializer) Deserialize(b []byte, m proto.Message) error
type YamlSerializer ¶
type YamlSerializer struct{}
Click to show internal directories.
Click to hide internal directories.