(fileObj params.FileObject)
| 507 | } |
| 508 | |
| 509 | func formatOneObject(fileObj params.FileObject) { |
| 510 | if outputFormat == common.OutputFormatJSON { |
| 511 | printAsJSON(fileObj) |
| 512 | return |
| 513 | } |
| 514 | t := table.NewWriter() |
| 515 | t.Style().Options.SeparateHeader = true |
| 516 | header := table.Row{"Field", "Value"} |
| 517 | t.AppendHeader(header) |
| 518 | t.AppendRow([]interface{}{"ID", fileObj.ID}) |
| 519 | t.AppendRow([]interface{}{"Name", fileObj.Name}) |
| 520 | t.AppendRow([]interface{}{"Created At", fileObj.CreatedAt}) |
| 521 | t.AppendRow([]interface{}{"Updated At", fileObj.UpdatedAt}) |
| 522 | t.AppendRow([]interface{}{"Size", fileObj.Size}) |
| 523 | t.AppendRow([]interface{}{"SHA256SUM", fileObj.SHA256}) |
| 524 | t.AppendRow([]interface{}{"File Type", fileObj.FileType}) |
| 525 | t.AppendRow([]interface{}{"Description", fileObj.Description}) |
| 526 | |
| 527 | if len(fileObj.Tags) > 0 { |
| 528 | t.AppendRow([]interface{}{"Tags", strings.Join(fileObj.Tags, ", ")}) |
| 529 | } |
| 530 | t.SetColumnConfigs([]table.ColumnConfig{ |
| 531 | {Number: 1, AutoMerge: true}, |
| 532 | {Number: 2, AutoMerge: false, WidthMax: 100}, |
| 533 | }) |
| 534 | fmt.Println(t.Render()) |
| 535 | } |
| 536 | |
| 537 | func formatFileObjsList(files params.FileObjectPaginatedResponse) { |
| 538 | if outputFormat == common.OutputFormatJSON { |
no test coverage detected