github.com/vmware/govmomi@v0.51.0/cli/license/output.go (about) 1 // © Broadcom. All Rights Reserved. 2 // The term “Broadcom” refers to Broadcom Inc. and/or its subsidiaries. 3 // SPDX-License-Identifier: Apache-2.0 4 5 package license 6 7 import ( 8 "fmt" 9 "io" 10 "os" 11 "text/tabwriter" 12 13 "github.com/vmware/govmomi/vim25/types" 14 ) 15 16 type licenseOutput []types.LicenseManagerLicenseInfo 17 18 func (res licenseOutput) Write(w io.Writer) error { 19 tw := tabwriter.NewWriter(os.Stdout, 4, 0, 2, ' ', 0) 20 fmt.Fprintf(tw, "Key:\tEdition:\tUsed:\tTotal:\n") 21 for _, v := range res { 22 fmt.Fprintf(tw, "%s\t", v.LicenseKey) 23 fmt.Fprintf(tw, "%s\t", v.EditionKey) 24 fmt.Fprintf(tw, "%d\t", v.Used) 25 fmt.Fprintf(tw, "%d\t", v.Total) 26 fmt.Fprintf(tw, "\n") 27 } 28 return tw.Flush() 29 }