Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Silence "config warnings" in text mode, except for config ... commands #2641

Merged
merged 1 commit into from
Jun 17, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 8 additions & 2 deletions main.go
Original file line number Diff line number Diff line change
Expand Up @@ -76,8 +76,14 @@ func main() {
if parentPreRun != nil {
parentPreRun(cmd, args)
}
for _, warning := range configFileLoadingWarnings {
feedback.Warning(warning)

// In Text mode print the warnings about the configuration file
// only if we are inside the "config ..." command. In JSON mode always
// output the warning.
if feedback.GetFormat() != feedback.Text || (cmd.HasParent() && cmd.Parent().Name() == "config") {
for _, warning := range configFileLoadingWarnings {
feedback.Warning(fmt.Sprintf("%s: %s", i18n.Tr("Invalid value in configuration"), warning))
}
}
}

Expand Down
Loading