(repo params.Repository)
| 435 | } |
| 436 | |
| 437 | func formatOneRepository(repo params.Repository) { |
| 438 | if outputFormat == common.OutputFormatJSON { |
| 439 | printAsJSON(repo) |
| 440 | return |
| 441 | } |
| 442 | t := table.NewWriter() |
| 443 | rowConfigAutoMerge := table.RowConfig{AutoMerge: true} |
| 444 | header := table.Row{"Field", "Value"} |
| 445 | t.AppendHeader(header) |
| 446 | t.AppendRow(table.Row{"ID", repo.ID}) |
| 447 | t.AppendRow(table.Row{"Created At", repo.CreatedAt}) |
| 448 | t.AppendRow(table.Row{"Updated At", repo.UpdatedAt}) |
| 449 | t.AppendRow(table.Row{"Owner", repo.Owner}) |
| 450 | t.AppendRow(table.Row{"Name", repo.Name}) |
| 451 | t.AppendRow(table.Row{"Endpoint", repo.Endpoint.Name}) |
| 452 | t.AppendRow(table.Row{"Pool balancer type", repo.GetBalancerType()}) |
| 453 | t.AppendRow(table.Row{"Credentials", repo.GetCredentialsName()}) |
| 454 | t.AppendRow(table.Row{"Agent Mode", repo.AgentMode}) |
| 455 | t.AppendRow(table.Row{"Pool manager running", repo.PoolManagerStatus.IsRunning}) |
| 456 | if !repo.PoolManagerStatus.IsRunning { |
| 457 | t.AppendRow(table.Row{"Failure reason", repo.PoolManagerStatus.FailureReason}) |
| 458 | } |
| 459 | |
| 460 | if len(repo.Pools) > 0 { |
| 461 | for _, pool := range repo.Pools { |
| 462 | t.AppendRow(table.Row{"Pools", pool.ID}, rowConfigAutoMerge) |
| 463 | } |
| 464 | } |
| 465 | |
| 466 | if len(repo.Events) > 0 { |
| 467 | for _, event := range repo.Events { |
| 468 | t.AppendRow(table.Row{"Events", fmt.Sprintf("%s %s: %s", event.CreatedAt.Format("2006-01-02T15:04:05"), strings.ToUpper(string(event.EventLevel)), event.Message)}, rowConfigAutoMerge) |
| 469 | } |
| 470 | } |
| 471 | |
| 472 | t.SetColumnConfigs([]table.ColumnConfig{ |
| 473 | {Number: 1, AutoMerge: true}, |
| 474 | {Number: 2, AutoMerge: false, WidthMax: 100}, |
| 475 | }) |
| 476 | |
| 477 | fmt.Println(t.Render()) |
| 478 | } |
no test coverage detected