MCPcopy Create free account
hub / github.com/cloudbase/garm / formatOneTemplate

Function formatOneTemplate

cmd/garm-cli/cmd/templates.go:501–524  ·  view source on GitHub ↗
(template params.Template)

Source from the content-addressed store, hash-verified

499}
500
501func 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
526func formatTemplateList(templates params.Templates) {
527 if outputFormat == common.OutputFormatJSON {

Callers 1

templates.goFile · 0.85

Calls 1

printAsJSONFunction · 0.85

Tested by

no test coverage detected