-
Notifications
You must be signed in to change notification settings - Fork 1
/
comment.go
41 lines (34 loc) · 817 Bytes
/
comment.go
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
package main
import (
"github.com/spf13/cobra"
"gopkg.in/yaml.v3"
"io/ioutil"
)
func NewCmdDocComment() *cobra.Command {
cmd := &cobra.Command{
Use: "doc-comment",
Short: `Test lib-helm`,
DisableAutoGenTag: true,
RunE: func(cmd *cobra.Command, args []string) error {
filename := "/home/tamal/go/src/github.com/tamalsaha/chart-fusion/charts/values.yaml"
data, err := ioutil.ReadFile(filename)
if err != nil {
return err
}
var root yaml.Node
err = yaml.Unmarshal(data, &root)
if err != nil {
return err
}
for _, keyNode := range root.Content {
keyNode.LineComment = "# +doc-gen:break"
}
data, err = yaml.Marshal(&root)
if err != nil {
return err
}
return ioutil.WriteFile(filename, data, 0644)
},
}
return cmd
}