Skip to content

Commit 7219aa8

Browse files
authored
Silence config warnings in text mode except for 'config ...' commands (#2641)
1 parent c9c90df commit 7219aa8

File tree

1 file changed

+8
-2
lines changed

1 file changed

+8
-2
lines changed

main.go

+8-2
Original file line numberDiff line numberDiff line change
@@ -76,8 +76,14 @@ func main() {
7676
if parentPreRun != nil {
7777
parentPreRun(cmd, args)
7878
}
79-
for _, warning := range configFileLoadingWarnings {
80-
feedback.Warning(warning)
79+
80+
// In Text mode print the warnings about the configuration file
81+
// only if we are inside the "config ..." command. In JSON mode always
82+
// output the warning.
83+
if feedback.GetFormat() != feedback.Text || (cmd.HasParent() && cmd.Parent().Name() == "config") {
84+
for _, warning := range configFileLoadingWarnings {
85+
feedback.Warning(fmt.Sprintf("%s: %s", i18n.Tr("Invalid value in configuration"), warning))
86+
}
8187
}
8288
}
8389

0 commit comments

Comments
 (0)