Skip to content

Commit d116a59

Browse files
authored
add --silent flag (#74)
1 parent 162a9ad commit d116a59

File tree

3 files changed

+9
-1
lines changed

3 files changed

+9
-1
lines changed

cmd/cmd.go

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -110,6 +110,12 @@ func addVerboseFlag(flags *pflag.FlagSet) {
110110
"verbose output")
111111
}
112112

113+
func addSilentFlag(flags *pflag.FlagSet) {
114+
flags.BoolP(
115+
"silent", "s", false,
116+
"Silent or quiet mode. Do not show progress meter")
117+
}
118+
113119
func addHumanFlag(flags *pflag.FlagSet) {
114120
flags.BoolP(
115121
"human", "H", false,

cmd/vt.go

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -62,6 +62,7 @@ func NewVTCommand() *cobra.Command {
6262
addFormatFlag(cmd.PersistentFlags())
6363
addHostFlag(cmd.PersistentFlags())
6464
addProxyFlag(cmd.PersistentFlags())
65+
addSilentFlag(cmd.PersistentFlags())
6566
addVerboseFlag(cmd.PersistentFlags())
6667

6768
cmd.AddCommand(NewAnalysisCmd())

utils/do.go

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,7 @@ import (
2222
vt "github.com/VirusTotal/vt-go"
2323
"github.com/briandowns/spinner"
2424
"github.com/plusvic/go-ansi"
25+
"github.com/spf13/viper"
2526
)
2627

2728
// Coordinator coordinates the work of multiple instances of a Doer that run
@@ -115,7 +116,7 @@ func (c *Coordinator) DoWithItemsFromChannel(doer Doer, ch <-chan interface{}) {
115116
// stdout is being redirected to a file and we don't want escape sequences
116117
// in the output, in that case print only the final results from the doers,
117118
// without any progress indication.
118-
if color.NoColor {
119+
if color.NoColor || viper.GetBool("silent") {
119120
go c.printResultsOnly()
120121
} else {
121122
go c.printProgressAndResults()

0 commit comments

Comments
 (0)