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

fix: Enable quiet mode when --json flag is supplied #1271

Merged
merged 1 commit into from
Aug 5, 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
7 changes: 6 additions & 1 deletion pkg/app/run.go
Original file line number Diff line number Diff line change
Expand Up @@ -186,6 +186,11 @@ func Exec(data *global.Data) error {
return err
}

// Check for --json flag early and set quiet mode if found.
if slices.Contains(data.Args, "--json") {
data.Flags.Quiet = true
}

// We short-circuit the execution for specific cases:
//
// - argparser.ArgsIsHelpJSON() == true
Expand All @@ -200,7 +205,7 @@ func Exec(data *global.Data) error {
}

metadataDisable, _ := strconv.ParseBool(data.Env.WasmMetadataDisable)
if !slices.Contains(data.Args, "--metadata-disable") && !metadataDisable && !data.Config.CLI.MetadataNoticeDisplayed && commandCollectsData(commandName) {
if !slices.Contains(data.Args, "--metadata-disable") && !metadataDisable && !data.Config.CLI.MetadataNoticeDisplayed && commandCollectsData(commandName) && !data.Flags.Quiet {
text.Important(data.Output, "The Fastly CLI is configured to collect data related to Wasm builds (e.g. compilation times, resource usage, and other non-identifying data). To learn more about what data is being collected, why, and how to disable it: https://www.fastly.com/documentation/reference/cli")
text.Break(data.Output)
data.Config.CLI.MetadataNoticeDisplayed = true
Expand Down