MCPcopy Create free account
hub / github.com/chainloop-dev/chainloop / orgMembershipTableOutput

Function orgMembershipTableOutput

app/cli/cmd/organization_list.go:49–69  ·  view source on GitHub ↗
(items []*action.MembershipItem)

Source from the content-addressed store, hash-verified

47}
48
49func orgMembershipTableOutput(items []*action.MembershipItem) error {
50 if len(items) == 0 {
51 fmt.Println(UserWithNoOrganizationMsg)
52 return nil
53 }
54
55 // Get the current organization from viper configuration
56 currentOrg := viper.GetString(confOptions.organization.viperKey)
57
58 t := output.NewTableWriter()
59 t.AppendHeader(table.Row{"Name", "Current", "Default", "Role", "Default Policy strategy", "Joined At"})
60
61 for _, i := range items {
62 current := i.Org.Name == currentOrg
63 t.AppendRow(table.Row{i.Org.Name, current, i.Default, i.Role, i.Org.PolicyViolationBlockingStrategy, i.CreatedAt.Format(time.RFC822)})
64 t.AppendSeparator()
65 }
66
67 t.Render()
68 return nil
69}

Callers

nothing calls this directly

Calls 2

NewTableWriterFunction · 0.92
RenderMethod · 0.80

Tested by

no test coverage detected