(config *action.ConfigContextItem)
| 44 | } |
| 45 | |
| 46 | func contextTableOutput(config *action.ConfigContextItem) error { |
| 47 | gt := output.NewTableWriter() |
| 48 | gt.SetTitle("Current Context") |
| 49 | |
| 50 | gt.AppendRow(table.Row{"Logged in as", config.CurrentUser.PrintUserProfileWithEmail()}) |
| 51 | gt.AppendSeparator() |
| 52 | |
| 53 | if m := config.CurrentMembership; m != nil { |
| 54 | orgInfo := fmt.Sprintf("%s (role=%s)\nPolicy strategy: %s", m.Org.Name, m.Role, m.Org.PolicyViolationBlockingStrategy) |
| 55 | if len(m.Org.PolicyAllowedHostnames) > 0 { |
| 56 | orgInfo += fmt.Sprintf("\nPolicy allowed hostnames: %v", strings.Join(m.Org.PolicyAllowedHostnames, ", ")) |
| 57 | } |
| 58 | |
| 59 | if m.Org.APITokenMaxDaysInactive != nil { |
| 60 | orgInfo += fmt.Sprintf("\nAPI token auto-revoke after: %s days inactive", *m.Org.APITokenMaxDaysInactive) |
| 61 | } |
| 62 | |
| 63 | if m.Org.BlockAttestationsOnReleasedVersions { |
| 64 | orgInfo += "\nBlock attestations on released versions: enabled" |
| 65 | } |
| 66 | |
| 67 | gt.AppendRow(table.Row{"Organization", orgInfo}) |
| 68 | } |
| 69 | |
| 70 | backend := config.CurrentCASBackend |
| 71 | if backend != nil { |
| 72 | gt.AppendSeparator() |
| 73 | gt.AppendRow(table.Row{"Default CAS Backend", fmt.Sprintf("%s (provider=%s, status=%q)", backend.Location, backend.Provider, backend.ValidationStatus)}) |
| 74 | } |
| 75 | |
| 76 | gt.Render() |
| 77 | return nil |
| 78 | } |
nothing calls this directly
no test coverage detected