(ctx context.Context, rep repo.Repository)
| 29 | } |
| 30 | |
| 31 | func (c *commandPolicyShow) run(ctx context.Context, rep repo.Repository) error { |
| 32 | targets, err := c.policyTargets(ctx, rep) |
| 33 | if err != nil { |
| 34 | return err |
| 35 | } |
| 36 | |
| 37 | for _, target := range targets { |
| 38 | effective, definition, _, err := policy.GetEffectivePolicy(ctx, rep, target) |
| 39 | if err != nil { |
| 40 | return errors.Wrapf(err, "can't get effective policy for %q", target) |
| 41 | } |
| 42 | |
| 43 | if c.jo.jsonOutput { |
| 44 | c.out.printStdout("%s\n", c.jo.jsonBytes(effective)) |
| 45 | } else { |
| 46 | printPolicy(&c.out, effective, definition) |
| 47 | } |
| 48 | } |
| 49 | |
| 50 | return nil |
| 51 | } |
| 52 | |
| 53 | type policyTableRow struct { |
| 54 | name string |
nothing calls this directly
no test coverage detected