Refactored!

This commit is contained in:
Mike Farah
2019-12-28 20:19:37 +13:00
parent df52383ffb
commit 0652f67a91
9 changed files with 177 additions and 178 deletions
+3 -3
View File
@@ -257,7 +257,7 @@ func readProperty(cmd *cobra.Command, args []string) error {
return errorParsingDocIndex
}
var matchingNodes []*yqlib.VisitedNode
var matchingNodes []*yqlib.NodeContext
var currentIndex = 0
var errorReadingStream = readStream(args[0], func(decoder *yaml.Decoder) error {
@@ -292,7 +292,7 @@ func handleEOF(updateAll bool, docIndexInt int, currentIndex int) error {
return nil
}
func appendDocument(originalMatchingNodes []*yqlib.VisitedNode, dataBucket yaml.Node, path string, updateAll bool, docIndexInt int, currentIndex int) ([]*yqlib.VisitedNode, error) {
func appendDocument(originalMatchingNodes []*yqlib.NodeContext, dataBucket yaml.Node, path string, updateAll bool, docIndexInt int, currentIndex int) ([]*yqlib.NodeContext, error) {
log.Debugf("processing document %v - requested index %v", currentIndex, docIndexInt)
yqlib.DebugNode(&dataBucket)
if !updateAll && currentIndex != docIndexInt {
@@ -337,7 +337,7 @@ func printValue(node *yaml.Node, cmd *cobra.Command) error {
return nil
}
func printResults(matchingNodes []*yqlib.VisitedNode, cmd *cobra.Command) error {
func printResults(matchingNodes []*yqlib.NodeContext, cmd *cobra.Command) error {
if len(matchingNodes) == 0 {
log.Debug("no matching results, nothing to print")
return nil