mirror of
https://github.com/taigrr/yq
synced 2025-01-18 04:53:17 -08: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…
x
Reference in New Issue
Block a user