Documentation
¶
Overview ¶
Package explore implements `cinc explore`, a k9s-style terminal UI for browsing and mutating every object type on a Cinc/Chef server.
The shell (profile picker → kind menu → list → detail, plus modal overlays for editing, confirming, and prompting) is generic. Each object type plugs in through the Kind interface and a set of small, optional capability interfaces it opts into. The shell type-asserts those capabilities to decide which actions a kind supports — that is what makes the action bar change per resource.
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
Types ¶
type Creatable ¶
type Creatable interface {
NewTemplate() []byte
Create(ctx context.Context, c *cinc.Client, doc []byte) (CreateResult, error)
}
Creatable kinds create a new object from a JSON document the user edits, seeded with NewTemplate.
type CreateResult ¶
CreateResult reports the outcome of a create. Secret, when non-empty, is a one-time credential (a generated private key) the shell shows in a result modal because the server never returns it again.
type CustomForm ¶
CustomForm kinds supply their own modal editor (a typed form) instead of the generic JSON editor. NewForm returns nil to fall back to the JSON editor — so a kind can offer a form for some actions and not others.
type Downloadable ¶
type Downloadable interface {
Download(ctx context.Context, c *cinc.Client, name, destDir string) (string, error)
}
Downloadable kinds write an object to a local directory and report the path written.
type DrillDown ¶
DrillDown kinds contain children: selecting a row pushes the child kind, already scoped to the chosen parent.
type Editable ¶
type Editable interface {
Viewable
Save(ctx context.Context, c *cinc.Client, name string, edited []byte) error
}
Editable kinds open an object in the JSON editor and save the result.
type Kind ¶
type Kind interface {
Title() string
Columns() []string
List(ctx context.Context, c *cinc.Client) ([]Row, error)
}
Kind is one browsable object type. Every kind supports the read path: a titled, columned list of objects.
type NamedCreatable ¶
type NamedCreatable interface {
CreateNamed(ctx context.Context, c *cinc.Client, name string) (CreateResult, error)
}
NamedCreatable kinds create a new object from just a name (no body), gathered through a name-prompt modal.
type Options ¶
type Options struct {
// Profiles is every profile available to choose from.
Profiles map[string]config.Profile
// Preselected, when set, names the profile to use directly,
// skipping the picker (e.g. --profile or $CINC_PROFILE was given).
Preselected string
// NewClient builds an API client from a profile; injected so tests
// can supply an httptest-backed client. Defaults to client.New.
NewClient func(config.Profile) (*cinc.Client, error)
Stdin io.Reader
Stdout io.Writer
Stderr io.Writer
}
Options configures Run.
type Row ¶
Row is one object in a kind's list. Name is the identifier passed to the capability methods (Describe, Save, Delete, …); Cells holds the display values aligned with the kind's Columns.
type Searchable ¶
type Searchable interface {
SearchIndex() string
}
Searchable kinds can be queried server-side with a Solr/Lucene query. SearchIndex names the index to hit; an empty string means the kind is not search-indexed (the `s` key stays inert for it). Only node, role, environment, client, and data bag items live in the Chef search index.
type Summarizable ¶
type Summarizable interface {
Summary(ctx context.Context, c *cinc.Client, name string) (summaryView, error)
}
Summarizable kinds render a selected object as a curated, human-friendly facts panel in the split-screen summary pane. Every kind implements it (via the shared summarize helper), so hovering any object shows friendly values rather than raw JSON; the raw JSON stays one keypress away in the detail view.