Documentation
¶
Overview ¶
Package cli holds what strata's commands share: configuration loading through viper, opening the index, and output helpers. Commands in cmd/ stay thin and call into it.
Index ¶
- Variables
- func Close(svc *service.Service, err *error)
- func ConfigPaths() []string
- func OneOf(flag, value string, allowed ...string) error
- func Out(cmd *cobra.Command) io.Writer
- func Release(closeFn func() error, err *error)
- func Spin(ctx context.Context, cmd *cobra.Command, title string, ...) error
- type Backend
- type Remote
- func (r *Remote) Ancestry(ctx context.Context, ref, platform string) (*graph.Graph, error)
- func (r *Remote) Cleanup(ctx context.Context, opts service.CleanupOptions) (*service.Cleanup, error)
- func (r *Remote) Descendants(ctx context.Context, ref string, opts service.DescendantOptions) (*service.DescendantResult, error)
- func (r *Remote) Explain(ctx context.Context, ref, platform string, history bool) (*service.Explanation, error)
- func (r *Remote) Healthy(ctx context.Context) bool
- func (r *Remote) Lifecycles(ctx context.Context, opts service.LifecycleOptions) ([]service.Lifecycle, error)
- func (r *Remote) Query(ctx context.Context, opts service.QueryOptions) (*service.Table, error)
- func (r *Remote) QueryGraph(ctx context.Context, filter string, budget int) (*graph.Graph, error)
- func (r *Remote) Roots(ctx context.Context) ([]service.Root, error)
- func (r *Remote) Stale(ctx context.Context, groupBy string) (*service.Table, error)
- func (r *Remote) Summary(ctx context.Context, groupBy string) (*service.Summary, error)
- type State
Constants ¶
This section is empty.
Variables ¶
var ( Version = "dev" Commit = "none" Date = "unknown" )
Build information, set with -ldflags at release time.
Functions ¶
func ConfigPaths ¶
func ConfigPaths() []string
ConfigPaths returns the places a config file is looked for, in order: $XDG_CONFIG_HOME/strata/strata.yaml, ~/.config/strata/strata.yaml, ~/.strata.yaml and ./strata.yaml.
Types ¶
type Backend ¶
type Backend interface {
Explain(ctx context.Context, ref, platform string, history bool) (*service.Explanation, error)
Ancestry(ctx context.Context, ref, platform string) (*graph.Graph, error)
Descendants(ctx context.Context, ref string, opts service.DescendantOptions) (*service.DescendantResult, error)
Query(ctx context.Context, opts service.QueryOptions) (*service.Table, error)
QueryGraph(ctx context.Context, filter string, budget int) (*graph.Graph, error)
Stale(ctx context.Context, groupBy string) (*service.Table, error)
Roots(ctx context.Context) ([]service.Root, error)
Summary(ctx context.Context, groupBy string) (*service.Summary, error)
Cleanup(ctx context.Context, opts service.CleanupOptions) (*service.Cleanup, error)
Lifecycles(ctx context.Context, opts service.LifecycleOptions) ([]service.Lifecycle, error)
}
Backend answers read queries, from a local index or a running server. *service.Service satisfies it.
type Remote ¶
type Remote struct {
// contains filtered or unexported fields
}
Remote is a Backend over strata's HTTP API.
func NewRemote ¶
NewRemote returns a client for a strata server. authHeader, if set, is sent with the current user name, for servers behind a trusted-header proxy in development.
func (*Remote) Cleanup ¶ added in v0.3.0
func (r *Remote) Cleanup(ctx context.Context, opts service.CleanupOptions) (*service.Cleanup, error)
Cleanup fetches the deletion candidates.
func (*Remote) Descendants ¶
func (r *Remote) Descendants(ctx context.Context, ref string, opts service.DescendantOptions) (*service.DescendantResult, error)
Descendants fetches a descendant graph. A versions file is local-only.
func (*Remote) Explain ¶
func (r *Remote) Explain(ctx context.Context, ref, platform string, history bool) (*service.Explanation, error)
Explain resolves the ref, then fetches the image.
func (*Remote) Lifecycles ¶ added in v0.3.0
func (r *Remote) Lifecycles(ctx context.Context, opts service.LifecycleOptions) ([]service.Lifecycle, error)
Lifecycles fetches generated ECR lifecycle policies.
func (*Remote) QueryGraph ¶
QueryGraph draws a filter's matches on the server.
type State ¶
State is the loaded configuration for one command run.
func Load ¶
Load reads the config file, environment and the running command's flags. Precedence is flag, then STRATA_* environment, then file, then defaults. cfgFile overrides the search path.