github.com/diggerhq/digger/libs@v0.0.0-20240604170430-9d61cdf01cc5/comment_utils/utils/comments.go (about) 1 package utils 2 3 import "fmt" 4 5 func GetTerraformOutputAsCollapsibleComment(summary string, open bool) func(string) string { 6 var openTag string 7 if open { 8 openTag = "open=\"true\"" 9 } else { 10 openTag = "" 11 } 12 13 return func(comment string) string { 14 return fmt.Sprintf(`<details %v><summary>`+summary+`</summary> 15 16 `+"```terraform"+` 17 `+comment+` 18 `+"```"+` 19 </details>`, openTag) 20 } 21 } 22 23 func GetTerraformOutputAsComment(summary string) func(string) string { 24 return func(comment string) string { 25 return summary + "\n```terraform\n" + comment + "\n```" 26 } 27 } 28 29 func AsCollapsibleComment(summary string, open bool) func(string) string { 30 return func(comment string) string { 31 return fmt.Sprintf(`<details><summary>` + summary + `</summary> 32 ` + comment + ` 33 </details>`) 34 } 35 } 36 37 func AsComment(summary string) func(string) string { 38 return func(comment string) string { 39 return summary + "\n" + comment 40 } 41 }