Skip to content

Commit de4fbc0

Browse files
authored
feat: Make policy available in doc command (#593)
1 parent bd72b29 commit de4fbc0

File tree

2 files changed

+8
-0
lines changed

2 files changed

+8
-0
lines changed

internal/commands/document.go

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -36,6 +36,7 @@ type Document struct {
3636
Header Header
3737
URL string
3838
Rego string
39+
Policy rego.Rego
3940
}
4041

4142
//go:embed document_template.tpl
@@ -308,6 +309,7 @@ func getDocumentation(path string, outputDirectory string) (map[rego.Severity][]
308309
Header: header,
309310
URL: url,
310311
Rego: rego,
312+
Policy: policy,
311313
}
312314

313315
if policy.Severity() == "" {
Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
{{/* This is an example how to create a CSV file that includes the policy ID and the policy name */}}
2+
{{- range $severity, $value := . }}
3+
{{- range . }}
4+
{{ .Policy.PolicyID | default "-" }},{{ .Policy.Name }}
5+
{{- end }}
6+
{{- end }}

0 commit comments

Comments
 (0)