MCPcopy Create free account
hub / github.com/OctopusDeploy/cli / FormatDoc

Function FormatDoc

pkg/output/color.go:114–124  ·  view source on GitHub ↗

FormatDoc is designed to take a large block of heredoc text and replace formatting elements within it. Like a really cheap basic version of Markdown

(str string)

Source from the content-addressed store, hash-verified

112// FormatDoc is designed to take a large block of heredoc text and replace formatting elements within it.
113// Like a really cheap basic version of Markdown
114func FormatDoc(str string) string {
115 str = regexp.MustCompile("bold\\((.*?)\\)").ReplaceAllString(str, Bold("$1"))
116 str = regexp.MustCompile("green\\((.*?)\\)").ReplaceAllString(str, Green("$1"))
117 str = regexp.MustCompile("yellow\\((.*?)\\)").ReplaceAllString(str, Yellow("$1"))
118 str = regexp.MustCompile("blue\\((.*?)\\)").ReplaceAllString(str, Blue("$1"))
119 str = regexp.MustCompile("cyan\\((.*?)\\)").ReplaceAllString(str, Cyan("$1"))
120 str = regexp.MustCompile("magenta\\((.*?)\\)").ReplaceAllString(str, Magenta("$1"))
121 str = regexp.MustCompile("red\\((.*?)\\)").ReplaceAllString(str, Red("$1"))
122 str = regexp.MustCompile("dim\\((.*?)\\)").ReplaceAllString(str, Dim("$1"))
123 return str
124}

Callers 4

AskPackageOverrideLoopFunction · 0.92
PrintAdvancedSummaryFunction · 0.92
PrintAdvancedSummaryFunction · 0.92

Calls 8

BoldFunction · 0.85
GreenFunction · 0.85
YellowFunction · 0.85
BlueFunction · 0.85
CyanFunction · 0.85
MagentaFunction · 0.85
RedFunction · 0.85
DimFunction · 0.85

Tested by

no test coverage detected