From d864d3c6d75862f58ffd89e03264dfe657948daf Mon Sep 17 00:00:00 2001 From: Erik Svensson Date: Thu, 23 Nov 2023 14:01:00 +0100 Subject: [PATCH] add posibilty to use kubectl convention of '-f -' to read stdin --- main.go | 14 +++++++++----- 1 file changed, 9 insertions(+), 5 deletions(-) diff --git a/main.go b/main.go index d1eeb5b..0f0978e 100644 --- a/main.go +++ b/main.go @@ -41,12 +41,16 @@ func main() { } } if fn != "" { - c, err := helpers.ReadYamlFileToStringArr(fn) - if err != nil { - fmt.Printf("unable to read file %v, quitting\n", fn) - os.Exit(2) + if fn == "-" { + stdin = true + } else { + c, err := helpers.ReadYamlFileToStringArr(fn) + if err != nil { + fmt.Printf("unable to read file %v, quitting\n", fn) + os.Exit(2) + } + y = c } - y = c } if stdin {