| 70 | 70 |
// BarStyle constructs default bar style which can be altered via
|
| 71 | 71 |
// BarStyleComposer interface.
|
| 72 | 72 |
func BarStyle() BarStyleComposer {
|
| 73 | |
bs := &barStyle{
|
|
73 |
bs := barStyle{
|
| 74 | 74 |
style: defaultBarStyle,
|
| 75 | 75 |
tipFrames: []string{defaultBarStyle[iTip]},
|
| 76 | 76 |
}
|
|
| 80 | 80 |
return bs
|
| 81 | 81 |
}
|
| 82 | 82 |
|
| 83 | |
func (s *barStyle) Lbound(bound string) BarStyleComposer {
|
|
83 |
func (s barStyle) Lbound(bound string) BarStyleComposer {
|
| 84 | 84 |
s.style[iLbound] = bound
|
| 85 | 85 |
return s
|
| 86 | 86 |
}
|
| 87 | 87 |
|
| 88 | |
func (s *barStyle) LboundMeta(fn func(string) string) BarStyleComposer {
|
|
88 |
func (s barStyle) LboundMeta(fn func(string) string) BarStyleComposer {
|
| 89 | 89 |
s.metaFuncs[iLbound] = makeMetaFunc(fn)
|
| 90 | 90 |
return s
|
| 91 | 91 |
}
|
| 92 | 92 |
|
| 93 | |
func (s *barStyle) Rbound(bound string) BarStyleComposer {
|
|
93 |
func (s barStyle) Rbound(bound string) BarStyleComposer {
|
| 94 | 94 |
s.style[iRbound] = bound
|
| 95 | 95 |
return s
|
| 96 | 96 |
}
|
| 97 | 97 |
|
| 98 | |
func (s *barStyle) RboundMeta(fn func(string) string) BarStyleComposer {
|
|
98 |
func (s barStyle) RboundMeta(fn func(string) string) BarStyleComposer {
|
| 99 | 99 |
s.metaFuncs[iRbound] = makeMetaFunc(fn)
|
| 100 | 100 |
return s
|
| 101 | 101 |
}
|
| 102 | 102 |
|
| 103 | |
func (s *barStyle) Filler(filler string) BarStyleComposer {
|
|
103 |
func (s barStyle) Filler(filler string) BarStyleComposer {
|
| 104 | 104 |
s.style[iFiller] = filler
|
| 105 | 105 |
return s
|
| 106 | 106 |
}
|
| 107 | 107 |
|
| 108 | |
func (s *barStyle) FillerMeta(fn func(string) string) BarStyleComposer {
|
|
108 |
func (s barStyle) FillerMeta(fn func(string) string) BarStyleComposer {
|
| 109 | 109 |
s.metaFuncs[iFiller] = makeMetaFunc(fn)
|
| 110 | 110 |
return s
|
| 111 | 111 |
}
|
| 112 | 112 |
|
| 113 | |
func (s *barStyle) Refiller(refiller string) BarStyleComposer {
|
|
113 |
func (s barStyle) Refiller(refiller string) BarStyleComposer {
|
| 114 | 114 |
s.style[iRefiller] = refiller
|
| 115 | 115 |
return s
|
| 116 | 116 |
}
|
| 117 | 117 |
|
| 118 | |
func (s *barStyle) RefillerMeta(fn func(string) string) BarStyleComposer {
|
|
118 |
func (s barStyle) RefillerMeta(fn func(string) string) BarStyleComposer {
|
| 119 | 119 |
s.metaFuncs[iRefiller] = makeMetaFunc(fn)
|
| 120 | 120 |
return s
|
| 121 | 121 |
}
|
| 122 | 122 |
|
| 123 | |
func (s *barStyle) Padding(padding string) BarStyleComposer {
|
|
123 |
func (s barStyle) Padding(padding string) BarStyleComposer {
|
| 124 | 124 |
s.style[iPadding] = padding
|
| 125 | 125 |
return s
|
| 126 | 126 |
}
|
| 127 | 127 |
|
| 128 | |
func (s *barStyle) PaddingMeta(fn func(string) string) BarStyleComposer {
|
|
128 |
func (s barStyle) PaddingMeta(fn func(string) string) BarStyleComposer {
|
| 129 | 129 |
s.metaFuncs[iPadding] = makeMetaFunc(fn)
|
| 130 | 130 |
return s
|
| 131 | 131 |
}
|
| 132 | 132 |
|
| 133 | |
func (s *barStyle) Tip(frames ...string) BarStyleComposer {
|
|
133 |
func (s barStyle) Tip(frames ...string) BarStyleComposer {
|
| 134 | 134 |
if len(frames) != 0 {
|
| 135 | 135 |
s.tipFrames = frames
|
| 136 | 136 |
}
|
| 137 | 137 |
return s
|
| 138 | 138 |
}
|
| 139 | 139 |
|
| 140 | |
func (s *barStyle) TipMeta(fn func(string) string) BarStyleComposer {
|
|
140 |
func (s barStyle) TipMeta(fn func(string) string) BarStyleComposer {
|
| 141 | 141 |
s.metaFuncs[iTip] = makeMetaFunc(fn)
|
| 142 | 142 |
return s
|
| 143 | 143 |
}
|
| 144 | 144 |
|
| 145 | |
func (s *barStyle) TipOnComplete() BarStyleComposer {
|
|
145 |
func (s barStyle) TipOnComplete() BarStyleComposer {
|
| 146 | 146 |
s.tipOnComplete = true
|
| 147 | 147 |
return s
|
| 148 | 148 |
}
|
| 149 | 149 |
|
| 150 | |
func (s *barStyle) Reverse() BarStyleComposer {
|
|
150 |
func (s barStyle) Reverse() BarStyleComposer {
|
| 151 | 151 |
s.rev = true
|
| 152 | 152 |
return s
|
| 153 | 153 |
}
|
| 154 | 154 |
|
| 155 | |
func (s *barStyle) Build() BarFiller {
|
|
155 |
func (s barStyle) Build() BarFiller {
|
| 156 | 156 |
bf := &bFiller{
|
| 157 | 157 |
meta: s.metaFuncs,
|
| 158 | 158 |
tipOnComplete: s.tipOnComplete,
|