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 ¶
- func Run(node *cinc.Node) (*cinc.Node, bool, error)
- type Model
- func (m Model) Aborted() bool
- func (m Model) Changed() bool
- func (m Model) Committed() []byte
- func (m Model) Finished() bool
- func (m Model) Init() tea.Cmd
- func (m Model) Result() *cinc.Node
- func (m *Model) SetSize(w, h int)
- func (m Model) Update(msg tea.Msg) (Model, tea.Cmd)
- func (m Model) View() string
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
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 NewCreate ¶
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) Committed ¶
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) Result ¶
Result is the assembled node after a save, or nil if cancelled or still editing.
func (*Model) SetSize ¶
SetSize lays the form out for a w×h area. The standalone driver receives this through a WindowSizeMsg; an embedding caller calls it directly.