MCPcopy Create free account
hub / github.com/deepflowio/deepflow / padRight

Function padRight

cli/ctl/common/table/util.go:30–36  ·  view source on GitHub ↗

Pad String Right position This would place string at the left side of the screen

(s, pad string, width int)

Source from the content-addressed store, hash-verified

28// Pad String Right position
29// This would place string at the left side of the screen
30func padRight(s, pad string, width int) string {
31 gap := width - displayWidth(s)
32 if gap > 0 {
33 return s + strings.Repeat(string(pad), gap)
34 }
35 return s
36}
37
38func displayWidth(str string) int {
39 return runewidth.StringWidth(ansi.ReplaceAllLiteralString(str, ""))

Callers 2

printHeadingMethod · 0.85
printRowMethod · 0.85

Calls 1

displayWidthFunction · 0.85

Tested by

no test coverage detected