Compare commits

...

2 Commits

Author SHA1 Message Date
Adrian Thurston
76d7164117 fix: get test cases compiling again
Added the boolean parameter stripComments to the New.*Evaluator functions.
2022-06-16 11:02:26 -07:00
Adrian Thurston
cba925142f feat: added -t short option for --strip-comments
The -s short option was taken. Use the next letter in the first word, -t.
2022-06-16 11:00:25 -07:00
4 changed files with 4 additions and 4 deletions

View File

@@ -94,7 +94,7 @@ yq -P sample.json
rootCmd.PersistentFlags().StringVarP(&expressionFile, "from-file", "", "", "Load expression from specified file.")
rootCmd.PersistentFlags().BoolVarP(&stripComments, "strip-comments", "", false, "Strip comments from output.")
rootCmd.PersistentFlags().BoolVarP(&stripComments, "strip-comments", "t", false, "Strip comments from output.")
rootCmd.AddCommand(
createEvaluateSequenceCommand(),

View File

@@ -31,7 +31,7 @@ var evaluateNodesScenario = []expressionScenario{
}
func TestAllAtOnceEvaluateNodes(t *testing.T) {
var evaluator = NewAllAtOnceEvaluator()
var evaluator = NewAllAtOnceEvaluator(false)
for _, tt := range evaluateNodesScenario {
node := test.ParseData(tt.document)
list, _ := evaluator.EvaluateNodes(tt.expression, &node)

View File

@@ -171,7 +171,7 @@ func formatYaml(yaml string, filename string) string {
if err != nil {
panic(err)
}
streamEvaluator := NewStreamEvaluator()
streamEvaluator := NewStreamEvaluator(false)
_, err = streamEvaluator.Evaluate(filename, strings.NewReader(yaml), node, printer, "", NewYamlDecoder())
if err != nil {
panic(err)

View File

@@ -293,7 +293,7 @@ func TestPrinterScalarWithLeadingCont(t *testing.T) {
if err != nil {
panic(err)
}
streamEvaluator := NewStreamEvaluator()
streamEvaluator := NewStreamEvaluator(false)
_, err = streamEvaluator.Evaluate("sample", strings.NewReader(multiDocSample), node, printer, "# blah\n", NewYamlDecoder())
if err != nil {
panic(err)