Documentation
¶
Index ¶
Examples ¶
Constants ¶
This section is empty.
Variables ¶
View Source
var DefaultRunner = func() *Runner { result, err := NewRunner() if err != nil { log.Printf("Failed to create default runner: %v\n", err) } return result }()
DefaultRunner does not record Prometheus metrics
Functions ¶
This section is empty.
Types ¶
type Registry ¶
type Registry struct {
// contains filtered or unexported fields
}
Registry is a directory of available commands
Example ¶
r := NewRegistry("a registry") r.Add("Z command", func(_ []string) error { return nil }) r.Add("A command", func(_ []string) error { return nil }) r.Add("M command", func(_ []string) error { return nil }) list := r.List() fmt.Println(list) fmt.Println(r)
Output: [A command M command Z command] Command registry a registry: A command, M command, Z command
type Runner ¶ added in v0.0.13
type Runner struct {
// contains filtered or unexported fields
}
func NewRunner ¶ added in v0.0.13
func NewRunner(options ...RunnerOption) (*Runner, error)
type RunnerOption ¶ added in v0.0.13
func WithPrometheusNamespace ¶ added in v0.0.13
func WithPrometheusNamespace(namespace string) RunnerOption
WithPrometheusNamespace sets the namespace for the prometheus metrics. Prometheus metrics will be exposed only if this is called.
Click to show internal directories.
Click to hide internal directories.