From 6e4f56a96c27368ad09bf4e5695d5dd24a717968 Mon Sep 17 00:00:00 2001 From: Zachary Wasserman Date: Mon, 2 Nov 2020 16:14:46 -0800 Subject: [PATCH] Fix handling of --quiet flag in fleetctl query --- cmd/fleetctl/query.go | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/cmd/fleetctl/query.go b/cmd/fleetctl/query.go index ca3c651597b..3d82176a4e2 100644 --- a/cmd/fleetctl/query.go +++ b/cmd/fleetctl/query.go @@ -7,6 +7,7 @@ import ( "os" "strings" "time" + "io/ioutil" "github.com/briandowns/spinner" "github.com/urfave/cli" @@ -124,9 +125,10 @@ func queryCommand() cli.Command { // https://godoc.org/github.com/briandowns/spinner#pkg-variables s := spinner.New(spinner.CharSets[24], 200*time.Millisecond) s.Writer = os.Stderr - if !flQuiet { - s.Start() + if flQuiet { + s.Writer = ioutil.Discard } + s.Start() var timeoutChan <-chan time.Time if flTimeout > 0 { @@ -176,9 +178,7 @@ func queryCommand() cli.Command { } msg := fmt.Sprintf(" %.f%% responded (%.f%% online) | %d/%d targeted hosts (%d/%d online)", percentTotal, percentOnline, responded, total, responded, online) - if !flQuiet { - s.Suffix = msg - } + s.Suffix = msg if total == responded && status != nil { s.Stop() if !flQuiet {