nodeedit

package
v0.28.0 Latest Latest
Warning

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

Go to latest
Published: Nov 9, 2026 License: Apache-2.0 Imports: 10 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 nodeedit is a bubbletea form for editing a Chef/Cinc node. It presents the node's name, environment, policy, and run list as plain human-readable fields and its editable attribute bags (normal, default, override) in the shared JSON editor — so the common parts of a node never look like raw JSON. The automatic bag is not editable: ohai recomputes it on every cinc run, so it is preserved untouched rather than shown. The pure node<->form conversions live here; the interactive Model lives in model.go.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Run

func Run(node *cinc.Node) (*cinc.Node, bool, error)

Run drives the node-edit form as a standalone full-screen program. It returns the edited node and whether it differs from the input. A cancelled edit returns an error.

Types

type Model

type Model struct {
	// contains filtered or unexported fields
}

Model is the node edit/create form. Environment, policy, and run list are plain fields; the attribute bags are edited in the embedded JSON editor. When editing, the node name is a read-only heading; when creating (see NewCreate) it is an editable field at the top. The form owns the lifecycle (Ctrl-D saves the whole node, Ctrl-C cancels) and forwards other keys to the focused field.

func New

func New(node *cinc.Node) (Model, error)

New builds a node-edit form seeded from node.

func NewCreate

func NewCreate() (Model, error)

NewCreate builds a blank node-create form: an editable name field at the top, empty environment/policy/run-list fields, and empty attribute bags.

func (Model) Aborted

func (m Model) Aborted() bool

Aborted reports whether the user cancelled.

func (Model) Changed

func (m Model) Changed() bool

Changed reports whether the saved node differs from the original.

func (Model) Committed

func (m Model) Committed() []byte

Committed is the saved node as JSON, for callers that drive the form as an embedded modal sub-editor (the explorer). It is nil if the user cancelled or is still editing.

func (Model) Finished

func (m Model) Finished() bool

Finished reports whether the user saved or cancelled.

func (Model) Init

func (m Model) Init() tea.Cmd

func (Model) Result

func (m Model) Result() *cinc.Node

Result is the assembled node after a save, or nil if cancelled or still editing.

func (*Model) SetSize

func (m *Model) SetSize(w, h int)

SetSize lays the form out for a w×h area. The standalone driver receives this through a WindowSizeMsg; an embedding caller calls it directly.

func (Model) Update

func (m Model) Update(msg tea.Msg) (Model, tea.Cmd)

Update advances the form. It returns the concrete Model so the standalone driver and tests can read Finished/Result without a type assertion.

func (Model) View

func (m Model) View() string

Jump to

Keyboard shortcuts

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