in tools/mig-scaler/list.go [159:198]
func formatTable(jobs []*Job, detailed bool) {
w := tabwriter.NewWriter(os.Stdout, 0, 0, 1, ' ', 0)
if detailed {
// detailed is unlikely to fit on a single line unless
fmt.Fprint(w, "ID\tProject\tRegion\tZone\tName\tTarget\tIncrement\tWait\tStatus\tStarted\tFinished\tDeadline\n")
for _, j := range jobs {
fmt.Fprintf(w, "%s\t%s\t%s\t%s\t%s\t%d\t%d\t%s\t%s\t%s\t%s\t%s\n",
j.ID,
j.MIG.Project,
j.MIG.Region,
j.MIG.Zone,
j.MIG.Name,
j.TargetSize,
j.Increment,
j.Wait,
j.State,
formatTimestamp(j.StartTime),
formatTimestamp(j.EndTime),
j.Deadline,
)
}
} else {
// keep the output compact to try and fit within 80 columns
fmt.Fprint(w, "Project\tLocation\tName\tTarget\tIncrement\tWait\tStatus\n")
for _, j := range jobs {
fmt.Fprintf(w, "%s\t%s\t%s\t%d\t%d\t%s\t%s\n",
j.MIG.Project,
j.MIG.Location(),
j.MIG.Name,
j.TargetSize,
j.Increment,
j.Wait,
j.State,
)
}
}
w.Flush()
}