Skip to content

Commit f0e5d57

Browse files
author
Sven SAULEAU
authored
Merge pull request #34 from ByteArena/feat-quiet-option
Implement quiet mode for output
2 parents 4789676 + 0be4048 commit f0e5d57

2 files changed

Lines changed: 10 additions & 2 deletions

File tree

cmd/ba/main.go

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -91,6 +91,7 @@ func makeapp() *cli.App {
9191
cli.StringFlag{Name: "map", Value: "hexagon", Usage: "Name of the map used by the trainer"},
9292
cli.BoolFlag{Name: "no-browser", Usage: "Disable automatic browser opening at start"},
9393
cli.BoolFlag{Name: "debug", Usage: "Enable debug logging"},
94+
cli.BoolFlag{Name: "quiet", Usage: "Decrease verbosity of the output"},
9495
cli.BoolFlag{Name: "profile", Usage: "Enable execution profiling"},
9596
cli.BoolFlag{Name: "dump-raw-comm", Usage: "Dump all the communication between the agent and the server"},
9697
cli.IntFlag{Name: "duration", Usage: "If set, game will stop after this durarion (in seconds)"},
@@ -105,6 +106,7 @@ func makeapp() *cli.App {
105106
mapName := c.String("map")
106107
nobrowser := c.Bool("no-browser")
107108
isDebug := c.Bool("debug")
109+
isQuiet := c.Bool("quiet")
108110
shouldProfile := c.Bool("profile")
109111
dumpRaw := c.Bool("dump-raw-comm")
110112
duration := c.Int("duration")
@@ -118,6 +120,7 @@ func makeapp() *cli.App {
118120
recordFile,
119121
agents,
120122
isDebug,
123+
isQuiet,
121124
mapName,
122125
shouldProfile,
123126
dumpRaw,

subcommand/train/main.go

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -60,6 +60,7 @@ func TrainAction(
6060
recordFile string,
6161
agentimages []string,
6262
isDebug bool,
63+
isQuiet bool,
6364
mapName string,
6465
shouldProfile,
6566
dumpRaw bool,
@@ -156,13 +157,17 @@ func TrainAction(
156157

157158
switch t := msg.(type) {
158159
case arenaserver.EventStatusGameUpdate:
159-
fmt.Printf(GameColor("[game] %s\n"), t.Status)
160+
if !isQuiet {
161+
fmt.Printf(GameColor("[game] %s\n"), t.Status)
162+
}
160163

161164
case arenaserver.EventAgentLog:
162165
fmt.Printf(AgentColor("[agent] %s\n"), t.Value)
163166

164167
case arenaserver.EventLog:
165-
fmt.Printf(LogColor("[log] %s\n"), t.Value)
168+
if !isQuiet {
169+
fmt.Printf(LogColor("[log] %s\n"), t.Value)
170+
}
166171

167172
case arenaserver.EventDebug:
168173
debug(t.Value)

0 commit comments

Comments
 (0)