explore

package
v0.25.0 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Sep 24, 2026 License: Apache-2.0 Imports: 26 Imported by: ? modules, 0 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

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

func Run

func Run(ctx context.Context, opts Options) error

Run launches the explore TUI. It resolves the entry screen — straight to the object-type menu when the profile is unambiguous, otherwise the profile picker — and drives the bubbletea program.

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

type CreateResult struct {
	Name   string
	Secret string
}

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

type CustomForm interface {
	NewForm(action editAction, seed []byte) (subEditor, error)
}

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 Deletable

type Deletable interface {
	Delete(ctx context.Context, c *cinc.Client, name string) error
}

Deletable kinds delete an object by name.

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

type DrillDown interface {
	Child(parent string) Kind
}

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

type Row struct {
	Name  string
	Cells []string
}

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.

type Viewable

type Viewable interface {
	Describe(ctx context.Context, c *cinc.Client, name string) (string, error)
}

Viewable kinds render a single object as pretty JSON in the detail pane.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL