Documentation
¶
Overview ¶
Copyright © 2022 david amick git@davidamick.com
Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License.
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func CountComments ¶
CountComments counts the total number of comments in a YAML node tree.
func FormatSummary ¶
func FormatSummary(filePath string, descriptions []MoveDescription, addedFields []compare.AddedField, commentCount int) string
FormatSummary produces a human-readable summary of changes for a file. The output nests paths hierarchically to resemble a YAML structure.
func IsTerminal ¶
func IsTerminal() bool
IsTerminal reports whether stdout is connected to a terminal.
Types ¶
type KeyInfo ¶
type KeyInfo struct {
Key string
ValueKind yaml.Kind // ScalarNode, MappingNode, SequenceNode
Value string // scalar value, empty for maps/sequences
}
KeyInfo holds a key name plus information about its value for display.
type MoveDescription ¶
type MoveDescription struct {
Path string // e.g., "metadata", "spec.template.spec.containers[0]"
Keys []KeyInfo
Action string // e.g., "move before labels", "move to top"
}
MoveDescription describes a structural change at a particular YAML path.
func ComputeDescriptions ¶
func ComputeDescriptions(oldNode, newNode *compare.Node) []MoveDescription
ComputeDescriptions compares old and new YAML node trees and returns structural descriptions of what moved.