(template params.Template)
| 499 | } |
| 500 | |
| 501 | func formatOneTemplate(template params.Template) { |
| 502 | if outputFormat == common.OutputFormatJSON { |
| 503 | printAsJSON(template) |
| 504 | return |
| 505 | } |
| 506 | t := table.NewWriter() |
| 507 | header := table.Row{"Field", "Value"} |
| 508 | t.AppendHeader(header) |
| 509 | |
| 510 | t.AppendRow(table.Row{"ID", template.ID}) |
| 511 | t.AppendRow(table.Row{"Created At", template.CreatedAt}) |
| 512 | t.AppendRow(table.Row{"Updated At", template.UpdatedAt}) |
| 513 | t.AppendRow(table.Row{"Name", template.Name}) |
| 514 | t.AppendRow(table.Row{"Description", template.Description}) |
| 515 | t.AppendRow(table.Row{"Owner", template.Owner}) |
| 516 | t.AppendRow(table.Row{"Forge Type", template.ForgeType}) |
| 517 | t.AppendRow(table.Row{"OS Type", template.OSType}) |
| 518 | |
| 519 | t.SetColumnConfigs([]table.ColumnConfig{ |
| 520 | {Number: 1, AutoMerge: true}, |
| 521 | {Number: 2, AutoMerge: false, WidthMax: 100}, |
| 522 | }) |
| 523 | fmt.Println(t.Render()) |
| 524 | } |
| 525 | |
| 526 | func formatTemplateList(templates params.Templates) { |
| 527 | if outputFormat == common.OutputFormatJSON { |
no test coverage detected