mirror of
https://github.com/mikefarah/yq.git
synced 2024-11-12 13:48:06 +00:00
Fixing github build
This commit is contained in:
parent
01b4917f26
commit
dedd1ca892
@ -1,7 +1,5 @@
|
|||||||
#!/bin/bash
|
#!/bin/bash
|
||||||
|
|
||||||
set -eo pipefail
|
|
||||||
|
|
||||||
setUp() {
|
setUp() {
|
||||||
rm test*.yml || true
|
rm test*.yml || true
|
||||||
cat >test.yml <<EOL
|
cat >test.yml <<EOL
|
||||||
|
@ -136,7 +136,7 @@ func evaluateAll(cmd *cobra.Command, args []string) (cmdError error) {
|
|||||||
case 1:
|
case 1:
|
||||||
if nullInput {
|
if nullInput {
|
||||||
err = yqlib.NewStreamEvaluator().EvaluateNew(processExpression(args[0]), printer, "")
|
err = yqlib.NewStreamEvaluator().EvaluateNew(processExpression(args[0]), printer, "")
|
||||||
} else if pipingStdIn && args[0] != "-" {
|
} else if pipingStdIn && args[0] != "-" && !maybeFile(args[0]) {
|
||||||
// must have given a single expression and piping input from stdin
|
// must have given a single expression and piping input from stdin
|
||||||
err = allAtOnceEvaluator.EvaluateFiles(processExpression(args[0]), []string{"-"}, printer, leadingContentPreProcessing, decoder)
|
err = allAtOnceEvaluator.EvaluateFiles(processExpression(args[0]), []string{"-"}, printer, leadingContentPreProcessing, decoder)
|
||||||
|
|
||||||
|
@ -155,7 +155,7 @@ func evaluateSequence(cmd *cobra.Command, args []string) (cmdError error) {
|
|||||||
case 1:
|
case 1:
|
||||||
if nullInput {
|
if nullInput {
|
||||||
err = streamEvaluator.EvaluateNew(processExpression(args[0]), printer, "")
|
err = streamEvaluator.EvaluateNew(processExpression(args[0]), printer, "")
|
||||||
} else if pipingStdIn && args[0] != "-" {
|
} else if pipingStdIn && args[0] != "-" && !maybeFile(args[0]) {
|
||||||
// must have given a single expression and piping input from stdin
|
// must have given a single expression and piping input from stdin
|
||||||
err = streamEvaluator.EvaluateFiles(processExpression(args[0]), []string{"-"}, printer, leadingContentPreProcessing, decoder)
|
err = streamEvaluator.EvaluateFiles(processExpression(args[0]), []string{"-"}, printer, leadingContentPreProcessing, decoder)
|
||||||
} else {
|
} else {
|
||||||
|
10
cmd/utils.go
10
cmd/utils.go
@ -91,3 +91,13 @@ func configureEncoder(format yqlib.PrinterOutputFormat) yqlib.Encoder {
|
|||||||
}
|
}
|
||||||
panic("invalid encoder")
|
panic("invalid encoder")
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// this is a hack to enable backwards compatibility with githubactions (which pipe /dev/null into everything)
|
||||||
|
// and being able to call yq with the filename as a single parameter
|
||||||
|
//
|
||||||
|
// without this - yq detects there is stdin (thanks githubactions),
|
||||||
|
// then tries to parse the filename as an expression
|
||||||
|
func maybeFile(str string) bool {
|
||||||
|
_, err := os.Stat(str) // #nosec
|
||||||
|
return err == nil
|
||||||
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user