mirror of
https://github.com/mikefarah/yq.git
synced 2024-12-19 20:19:04 +00:00
Detect when there is no document X to update
This commit is contained in:
parent
1a4064429d
commit
2f5a481cc3
5
yq.go
5
yq.go
@ -29,7 +29,7 @@ var log = logging.MustGetLogger("yq")
|
|||||||
func main() {
|
func main() {
|
||||||
cmd := newCommandCLI()
|
cmd := newCommandCLI()
|
||||||
if err := cmd.Execute(); err != nil {
|
if err := cmd.Execute(); err != nil {
|
||||||
fmt.Println(err.Error())
|
log.Error(err.Error())
|
||||||
os.Exit(1)
|
os.Exit(1)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -283,6 +283,9 @@ func mapYamlDecoder(updateData updateDataFn, encoder *yaml.Encoder) yamlDecoderF
|
|||||||
errorReading = decoder.Decode(&dataBucket)
|
errorReading = decoder.Decode(&dataBucket)
|
||||||
|
|
||||||
if errorReading == io.EOF {
|
if errorReading == io.EOF {
|
||||||
|
if currentIndex < docIndex {
|
||||||
|
return fmt.Errorf("Asked to process document %v but there are only %v document(s)", docIndex, currentIndex)
|
||||||
|
}
|
||||||
return nil
|
return nil
|
||||||
} else if errorReading != nil {
|
} else if errorReading != nil {
|
||||||
return fmt.Errorf("Error reading document at index %v, %v", currentIndex, errorReading)
|
return fmt.Errorf("Error reading document at index %v, %v", currentIndex, errorReading)
|
||||||
|
Loading…
Reference in New Issue
Block a user