From 1768c495416997c7a6769c6a92b33b37c89eed25 Mon Sep 17 00:00:00 2001 From: Ondrej Fabry Date: Sat, 17 Nov 2018 19:40:24 +0100 Subject: Rename skipzero flag to all Change-Id: I3ec848c3c7ba00481f6642c01e446bba935abf5b Signed-off-by: Ondrej Fabry --- examples/cmd/stats-api/stats_api.go | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/examples/cmd/stats-api/stats_api.go b/examples/cmd/stats-api/stats_api.go index bded8fd..6fd46d2 100644 --- a/examples/cmd/stats-api/stats_api.go +++ b/examples/cmd/stats-api/stats_api.go @@ -34,7 +34,7 @@ import ( var ( statsSocket = flag.String("socket", vppapiclient.DefaultStatSocket, "VPP stats segment socket") - skipZeros = flag.Bool("skipzero", true, "Skip stats with zero values") + dumpAll = flag.Bool("all", false, "Dump all stats including ones with zero values") ) func init() { @@ -72,7 +72,7 @@ func main() { switch cmd { case "dump": - dumpStats(client, patterns) + dumpStats(client, patterns, !*dumpAll) default: listStats(client, patterns) } @@ -93,7 +93,7 @@ func listStats(client adapter.StatsAPI, patterns []string) { fmt.Printf("Listed %d stats\n", len(list)) } -func dumpStats(client adapter.StatsAPI, patterns []string) { +func dumpStats(client adapter.StatsAPI, patterns []string, skipZeros bool) { fmt.Printf("Dumping stats.. %s\n", strings.Join(patterns, " ")) stats, err := client.DumpStats(patterns...) @@ -103,7 +103,7 @@ func dumpStats(client adapter.StatsAPI, patterns []string) { n := 0 for _, stat := range stats { - if isZero(stat.Data) && *skipZeros { + if isZero(stat.Data) && skipZeros { continue } fmt.Printf(" - %-25s %25v %+v\n", stat.Name, stat.Type, stat.Data) -- cgit 1.2.3-korg