github.com/brahmaroutu/docker@v1.2.1-0.20160809185609-eb28dde01f16/api/client/formatter/custom.go (about) 1 package formatter 2 3 import ( 4 "strings" 5 ) 6 7 const ( 8 tableKey = "table" 9 10 imageHeader = "IMAGE" 11 createdSinceHeader = "CREATED" 12 createdAtHeader = "CREATED AT" 13 sizeHeader = "SIZE" 14 labelsHeader = "LABELS" 15 nameHeader = "NAME" 16 driverHeader = "DRIVER" 17 scopeHeader = "SCOPE" 18 ) 19 20 type subContext interface { 21 fullHeader() string 22 addHeader(header string) 23 } 24 25 type baseSubContext struct { 26 header []string 27 } 28 29 func (c *baseSubContext) fullHeader() string { 30 if c.header == nil { 31 return "" 32 } 33 return strings.Join(c.header, "\t") 34 } 35 36 func (c *baseSubContext) addHeader(header string) { 37 if c.header == nil { 38 c.header = []string{} 39 } 40 c.header = append(c.header, strings.ToUpper(header)) 41 } 42 43 func stripNamePrefix(ss []string) []string { 44 sss := make([]string, len(ss)) 45 for i, s := range ss { 46 sss[i] = s[1:] 47 } 48 49 return sss 50 }