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

Function formatRepositories

cmd/garm-cli/cmd/repository.go:411–435  ·  view source on GitHub ↗
(repos []params.Repository)

Source from the content-addressed store, hash-verified

409}
410
411func formatRepositories(repos []params.Repository) {
412 if outputFormat == common.OutputFormatJSON {
413 printAsJSON(repos)
414 return
415 }
416 t := table.NewWriter()
417 header := table.Row{"ID", "Owner", "Name", "Endpoint", "Credentials name", "Pool Balancer Type", "Forge type", "Pool mgr running"}
418 if long {
419 header = append(header, "Created At", "Updated At")
420 }
421 t.AppendHeader(header)
422 for _, val := range repos {
423 forgeType := val.Endpoint.EndpointType
424 if forgeType == "" {
425 forgeType = params.GithubEndpointType
426 }
427 row := table.Row{val.ID, val.Owner, val.Name, val.Endpoint.Name, val.GetCredentialsName(), val.GetBalancerType(), forgeType, val.PoolManagerStatus.IsRunning}
428 if long {
429 row = append(row, val.CreatedAt, val.UpdatedAt)
430 }
431 t.AppendRow(row)
432 t.AppendSeparator()
433 }
434 fmt.Println(t.Render())
435}
436
437func formatOneRepository(repo params.Repository) {
438 if outputFormat == common.OutputFormatJSON {

Callers 1

repository.goFile · 0.85

Calls 3

printAsJSONFunction · 0.85
GetCredentialsNameMethod · 0.80
GetBalancerTypeMethod · 0.45

Tested by

no test coverage detected