summaryrefslogtreecommitdiff
path: root/internal
diff options
context:
space:
mode:
authorDave Henderson <dhenderson@gmail.com>2022-05-29 10:58:39 -0400
committerDave Henderson <dhenderson@gmail.com>2022-05-29 11:12:11 -0400
commitb2df8f62bc47adb58889b273434c9f16c03301d6 (patch)
tree40aada3f3fb0c90124a11c8ee71a25f04f369ef1 /internal
parentd9b8de8065d05ccd46e5a323f5675a46acfa183c (diff)
Simplify template processing
Signed-off-by: Dave Henderson <dhenderson@gmail.com>
Diffstat (limited to 'internal')
-rw-r--r--internal/cmd/config.go1
-rw-r--r--internal/config/configfile.go10
2 files changed, 10 insertions, 1 deletions
diff --git a/internal/cmd/config.go b/internal/cmd/config.go
index 6f0c3673..d48c6b63 100644
--- a/internal/cmd/config.go
+++ b/internal/cmd/config.go
@@ -25,7 +25,6 @@ var fs = afero.NewOsFs()
// - creates a config.Config from the cobra flags
// - creates a config.Config from the config file (if present)
// - merges the two (flags take precedence)
-// - validates the final config
func loadConfig(cmd *cobra.Command, args []string) (*config.Config, error) {
ctx := cmd.Context()
flagConfig, err := cobraConfig(cmd, args)
diff --git a/internal/config/configfile.go b/internal/config/configfile.go
index ccc16227..1cd4a473 100644
--- a/internal/config/configfile.go
+++ b/internal/config/configfile.go
@@ -492,6 +492,16 @@ func isZero(value interface{}) bool {
// ApplyDefaults - any defaults changed here should be added to cmd.InitFlags as
// well for proper help/usage display.
func (c *Config) ApplyDefaults() {
+ if c.Stdout == nil {
+ c.Stdout = os.Stdout
+ }
+ if c.Stderr == nil {
+ c.Stderr = os.Stderr
+ }
+ if c.Stdin == nil {
+ c.Stdin = os.Stdin
+ }
+
if c.InputDir != "" && c.OutputDir == "" && c.OutputMap == "" {
c.OutputDir = "."
}