Skip to content

Commit

Permalink
Enable quiet mode when --json flag is supplied (#1271)
Browse files Browse the repository at this point in the history
  • Loading branch information
kailan authored Aug 5, 2024
1 parent 9a458e4 commit 5fd3eb0
Showing 1 changed file with 6 additions and 1 deletion.
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

0 comments on commit 5fd3eb0

Please sign in to comment.