github.com/crowdsecurity/crowdsec@v1.6.1/cmd/crowdsec-cli/bouncers_table.go (about) 1 package main 2 3 import ( 4 "io" 5 "time" 6 7 "github.com/aquasecurity/table" 8 9 "github.com/crowdsecurity/crowdsec/pkg/database/ent" 10 "github.com/crowdsecurity/crowdsec/pkg/emoji" 11 ) 12 13 func getBouncersTable(out io.Writer, bouncers []*ent.Bouncer) { 14 t := newLightTable(out) 15 t.SetHeaders("Name", "IP Address", "Valid", "Last API pull", "Type", "Version", "Auth Type") 16 t.SetHeaderAlignment(table.AlignLeft, table.AlignLeft, table.AlignLeft, table.AlignLeft, table.AlignLeft, table.AlignLeft) 17 t.SetAlignment(table.AlignLeft, table.AlignLeft, table.AlignLeft, table.AlignLeft, table.AlignLeft, table.AlignLeft) 18 19 for _, b := range bouncers { 20 revoked := emoji.CheckMark 21 if b.Revoked { 22 revoked = emoji.Prohibited 23 } 24 25 t.AddRow(b.Name, b.IPAddress, revoked, b.LastPull.Format(time.RFC3339), b.Type, b.Version, b.AuthType) 26 } 27 28 t.Render() 29 }