MCPcopy Index your code
hub / github.com/cloudfoundry/cli / splitColumns

Function splitColumns

integration/helpers/app_instance_table.go:106–126  ·  view source on GitHub ↗
(row string)

Source from the content-addressed store, hash-verified

104}
105
106func splitColumns(row string) []string {
107 s := strings.TrimSpace(row)
108 // uses 3 spaces between columns
109 result := regexp.MustCompile(`\s{3,}`).Split(s, -1)
110
111 if regexp.MustCompile(`\s{31}`).MatchString(s) {
112
113 if len(result) == 8 {
114 // Both cpu entitlement and details are empty
115 result = append(result[:len(result)-1], "", "", result[len(result)-1])
116 } else {
117 // Only details is empty
118 result = append(result[:len(result)-2], result[len(result)-2], "", result[len(result)-1])
119 }
120
121 } else if regexp.MustCompile(`\s{21}`).MatchString(s) {
122 // cpu entitlement is empty, details is filled
123 result = append(result[:len(result)-2], "", result[len(result)-2], result[len(result)-1])
124 }
125 return result
126}

Callers 1

ParseV3AppProcessTableFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected