func printEndpointLabels(lbls *labels.OpLabels) { log.Debugf("All Labels %#v", *lbls) for _, lbl := range lbls.EndpointLabels { delete(lbls.UserLabels, lbl.Key) delete(lbls.ProbeLabels, lbl.Key) } w := tabwriter.NewWriter(os.Stdout, 2, 0, 3, ' ', 0) for _, v := range lbls.EndpointLabels { text := common.Green("Enabled") fmt.Fprintf(w, "%s\t%s\n", v, text) } for _, v := range lbls.ProbeLabels { text := common.Red("Disabled") fmt.Fprintf(w, "%s\t%s\n", v, text) } for _, v := range lbls.UserLabels { text := common.Red("Disabled") fmt.Fprintf(w, "%s\t%s\n", v, text) } w.Flush() }
func (sc StatusCode) String() string { var text string switch sc { case OK: text = common.Green("OK") case Warning: text = common.Yellow("Warning") case Failure: text = common.Red("Failure") case Disabled: text = common.Yellow("Disabled") default: text = "Unknown code" } return fmt.Sprintf("%s", text) }
func (o *BoolOptions) Dump() { if o == nil { return } opts := []string{} for k := range o.Opts { opts = append(opts, k) } sort.Strings(opts) for _, k := range opts { text := common.Green("Enabled") if !o.Opts[k] { text = common.Red("Disabled") } fmt.Printf("%-24s %s\n", k, text) } }