Added the parse option to yamltool because it gives much better error messages than yuamllint and yq.
This commit is contained in:
1 parent
ef0ef6e215
commit
6162670570
3 files changed
+25
-1
No files matched your search
@@ -2,7 +2,11 @@ package main
|
||||
|
||||
import (
|
||||
"bytes"
|
||||
"fmt"
|
||||
|
||||
"github.com/goccy/go-yaml"
|
||||
"github.com/spf13/cobra"
|
||||
|
||||
"os"
|
||||
)
|
||||
|
||||
@@ -24,3 +28,13 @@ func parse(data []byte) (yaml.MapSlice, error) {
|
||||
}
|
||||
return result, nil
|
||||
}
|
||||
|
||||
func parseFiles(cmd *cobra.Command, args []string) error {
|
||||
for _, arg := range args {
|
||||
_, err := parse(read(arg))
|
||||
if err != nil {
|
||||
fmt.Printf("%s: %v\n", arg, err.Error())
|
||||
}
|
||||
}
|
||||
return nil
|
||||
}
|
||||
Reference in new issue
Block a user