Open
Description
(below is more for discussion and see other reviewers' thought).
I think we should remove Output string
from ImageSaveOptions
. Functionally, it represents the same thing as Stdout io.Writer
and having both might cause inconsistency and confusing, for example:
- Even
Output != ""
, we initStdout = cmd.OutOrStdout()
when creatingImageSaveOptions
, and then change it after the file writer created (i.e., here). - Should a caller specify
Output
, orStdout io.Writer
?
If we remove Output
and keep Stdout
only:
pkg/cmd
side logic doesn't need to know where the writer comes from. It just writes content to it.- On
cmd
side, we initopt.Stdout = cmd.OutOrStdout()
ifoutput == ""
or create a file writer and use it asopt.Stdout
(i.e., this pard of code).
Originally posted by @djdongjin in #1924 (comment)