diff --git a/acceptance.bats b/acceptance.bats index d2366ad..1452c0a 100755 --- a/acceptance.bats +++ b/acceptance.bats @@ -12,6 +12,12 @@ [ "$output" = "The document stdin contains a valid ReplicationController" ] } +@test "Pass when parsing a valid Kubernetes config YAML file explicitly on stdin" { + run bash -c "cat fixtures/valid.yaml | kubeval -" + [ "$status" -eq 0 ] + [ "$output" = "The document stdin contains a valid ReplicationController" ] +} + @test "Pass when parsing a valid Kubernetes config JSON file" { run kubeval fixtures/valid.json [ "$status" -eq 0 ] diff --git a/cmd/root.go b/cmd/root.go index 615df70..6c460c8 100644 --- a/cmd/root.go +++ b/cmd/root.go @@ -40,7 +40,8 @@ var RootCmd = &cobra.Command{ } } // We detect whether we have anything on stdin to process if we have no arguments - if len(args) < 1 && !windowsStdinIssue && ((stat.Mode() & os.ModeCharDevice) == 0) { + // or if the argument is a - + if (len(args) < 1 || args[0] == "-") && !windowsStdinIssue && ((stat.Mode() & os.ModeCharDevice) == 0) { var buffer bytes.Buffer scanner := bufio.NewScanner(os.Stdin) for scanner.Scan() { diff --git a/glide.lock b/glide.lock index e0f2fab..8354638 100644 --- a/glide.lock +++ b/glide.lock @@ -1,19 +1,20 @@ hash: a8f1c32432725d048acd212267b87ac65a45259a64492371e95ff9357458098c -updated: 2018-02-24T10:45:58.9108918Z +updated: 2018-08-21T13:34:31.8946956+01:00 imports: - name: github.com/fatih/color - version: 507f6050b8568533fb3f5504de8e5205fa62a114 + version: 5b77d2a35fb0ede96d138fc9a99f5c9b6aef11b4 - name: github.com/fsnotify/fsnotify - version: 4da3e2cfbabc9f751898f250b49f2439785783a1 + version: c2828203cd70a50dcccfb2761f8b1f8ceef9a8e9 - name: github.com/hashicorp/errwrap - version: 7554cd9344cec97297fa6649b055a8c98c2a1e55 + version: d6c0cd88035724dd42e0f335ae30161c20575ecc - name: github.com/hashicorp/go-multierror - version: 83588e72410abfbe4df460eeb6f30841ae47d4c4 + version: 3d5d8f294aa03d8e98859feac328afbdf1ae0703 - name: github.com/hashicorp/hcl - version: 68e816d1c783414e79bc65b3994d9ab6b0a722ab + version: ef8a98b0bbce4a65b5aa4c368430a80ddc533168 subpackages: - hcl/ast - hcl/parser + - hcl/printer - hcl/scanner - hcl/strconv - hcl/token @@ -23,44 +24,44 @@ imports: - name: github.com/inconshreveable/mousetrap version: 76626ae9c91c4f2a10f34cad8ce83ea42c93bb75 - name: github.com/magiconair/properties - version: 8d7837e64d3c1ee4e54a880c5a920ab4316fc90a + version: c2353362d570a7bfa228149c62842019201cfb71 - name: github.com/mattn/go-colorable - version: 5411d3eea5978e6cdc258b30de592b60df6aba96 + version: efa589957cd060542a26d2dd7832fd6a6c6c3ade - name: github.com/mattn/go-isatty - version: 57fdcb988a5c543893cc61bce354a6e24ab70022 + version: 6ca4dbf54d38eea1a992b3c722a76a5d1c4cb25c - name: github.com/mitchellh/mapstructure - version: d0303fe809921458f417bcf828397a65db30a7e4 + version: f15292f7a699fcc1a38a80977f80a046874ba8ac - name: github.com/pelletier/go-toml - version: 1d6b12b7cb290426e27e6b4e38b89fcda3aeef03 + version: c2dbbc24a97911339e01bda0b8cabdbd8f13b602 - name: github.com/spf13/afero - version: ee1bd8ee15a1306d1f9201acc41ef39cd9f99a1b + version: 787d034dfe70e44075ccc060d346146ef53270ad subpackages: - mem - name: github.com/spf13/cast - version: acbeb36b902d72a7a4c18e8f3241075e7ab763e4 + version: 8965335b8c7107321228e3e3702cab9832751bac - name: github.com/spf13/cobra - version: b78744579491c1ceeaaa3b40205e56b0591b93a3 + version: ff0d02e8555041edecbd0ce27f32c6ea4b214483 - name: github.com/spf13/jwalterweatherman - version: 12bd96e66386c1960ab0f74ced1362f66f552f7b + version: 14d3d4c518341bea657dd8a226f5121c0ff8c9f2 - name: github.com/spf13/pflag - version: 7aff26db30c1be810f9de5038ec5ef96ac41fd7c + version: d929dcbb10863323c436af3cf76cb16a6dfc9b29 - name: github.com/spf13/viper - version: 25b30aa063fc18e48662b86996252eabdcf2f0c7 + version: 907c19d40d9a6c9bb55f040ff4ae45271a4754b9 - name: github.com/xeipuuv/gojsonpointer - version: 6fe8760cad3569743d51ddbb243b26f8456742dc + version: 4e3ac2762d5f479393488629ee9370b50873b3a6 - name: github.com/xeipuuv/gojsonreference - version: e02fc20de94c78484cd5ffb007f8af96be030a45 + version: bd5ef7bd5415a7ac448318e64f11a24cd21e594b - name: github.com/xeipuuv/gojsonschema - version: 3f523f4c14b6e925da10475eb0447c2f28614aac + version: da425ebb7609ba06a0f395fc8a254d1c303364a0 - name: golang.org/x/sys - version: 1e2299c37cc91a509f1b12369872d27be0ce98a6 + version: 4ea2f632f6e912459fe60b26b1749377f0d889d5 subpackages: - unix - name: golang.org/x/text - version: 1cbadb444a806fd9430d14ad08967ed91da4fa0a + version: 6e3c4e7365ddcc329f090f96e4348398f6310088 subpackages: - transform - unicode/norm - name: gopkg.in/yaml.v2 - version: eb3733d160e74a9c7e442f435eb3bea458e1d19f + version: 5420a8b6744d3b0345ab293f6fcba19c978f1183 testImports: []