Skip to content

Commit

Permalink
Don't generate values example if provided in the doc.yaml
Browse files Browse the repository at this point in the history
Signed-off-by: Tamal Saha <[email protected]>
  • Loading branch information
tamalsaha committed Jul 3, 2021
1 parent b533fcd commit dfe4f74
Showing 1 changed file with 13 additions and 10 deletions.
23 changes: 13 additions & 10 deletions main.go
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@ import (
"io"
"io/ioutil"
"os"
"strings"
"text/template"

"kubepack.dev/chart-doc-gen/api"
Expand Down Expand Up @@ -85,16 +86,18 @@ func main() {

doc.Chart.Values = buf.String()

for _, row := range rows {
if row[2] != "" &&
row[2] != `""` &&
row[2] != "{}" &&
row[2] != "[]" &&
row[2] != "true" &&
row[2] != "false" &&
row[2] != "not-ca-cert" {
doc.Chart.ValuesExample = fmt.Sprintf("%v=%v", row[0], row[2])
break
if doc.Chart.ValuesExample == "" || strings.HasPrefix(doc.Chart.ValuesExample, "-- generate from values file --") {
for _, row := range rows {
if row[2] != "" &&
row[2] != `""` &&
row[2] != "{}" &&
row[2] != "[]" &&
row[2] != "true" &&
row[2] != "false" &&
row[2] != "not-ca-cert" {
doc.Chart.ValuesExample = fmt.Sprintf("%v=%v", row[0], row[2])
break
}
}
}
} else if err == io.EOF {
Expand Down

0 comments on commit dfe4f74

Please sign in to comment.