You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Instead of taking --stdin-format to imply reading from stdin, use the
convention of supplying `-` as an argument to denote reading from
stdin, and just use the flag to alter how it's read.
This will line up better with expectations; and, since --stdin-format
can have a default (of "yaml"), invocations can be concise:
jk transform ./script.js -
.. rather than
jk transform ./script.js --stdin-format=yaml
Note that _no_ arguments does not imply reading from stdin. I did not
want something that accidentally supplies no filenames to block, since
that would make automation using `jk transform` brittle.
transformCmd.PersistentFlags().BoolVar(&transformOptions.stdout, "stdout", false, "print the resulting values to stdout")
54
+
transformCmd.PersistentFlags().BoolVar(&transformOptions.stdout, "stdout", false, "print the resulting values to stdout (implied if reading from stdin)")
44
55
transformCmd.PersistentFlags().BoolVar(&transformOptions.overwrite, "overwrite", false, "allow input file(s) to be overwritten by output file(s); otherwise, an error will be thrown")
45
-
transformCmd.PersistentFlags().StringVar(&transformOptions.format, "format", "", "force all values to this format")
46
-
transformCmd.PersistentFlags().StringVar(&transformOptions.stdinFormat, "stdin-format", "", "read values from stdin, assuming this format; implies --stdout")
56
+
transformCmd.PersistentFlags().StringVar(&transformOptions.format, "format", "", "force all output values to this format")
57
+
transformCmd.PersistentFlags().StringVar(&transformOptions.stdinFormat, "stdin-format", "yaml", "assume this format for values from stdin (either a 'yaml' stream or concatenated 'json' values)")
0 commit comments