Codebase list golang-github-vbauerster-mpb / 459c2a1
refactoring bar filler TipOnComplete is bool flag now Vladimir Bauer 2 years ago
3 changed file(s) with 237 addition(s) and 206 deletion(s). Raw diff Collapse all Expand all
1414 total := 100
1515 name := "Single Bar:"
1616 bar := p.New(int64(total),
17 mpb.BarStyle().TipOnComplete(">"),
17 mpb.BarStyle().TipOnComplete(),
1818 mpb.PrependDecorators(decor.Name(name)),
1919 mpb.AppendDecorators(decor.Percentage()),
2020 )
22 import (
33 "io"
44
5 "github.com/acarl005/stripansi"
65 "github.com/mattn/go-runewidth"
76 "github.com/vbauerster/mpb/v8/decor"
87 "github.com/vbauerster/mpb/v8/internal"
1413 iFiller
1514 iRefiller
1615 iPadding
16 iTip
1717 components
1818 )
19
20 var defaultBarStyle = [...]string{"[", "]", "=", "+", "-", ">"}
1921
2022 // BarStyleComposer interface.
2123 type BarStyleComposer interface {
2224 BarFillerBuilder
2325 Lbound(string) BarStyleComposer
26 LboundMeta(func(...interface{}) string) BarStyleComposer
2427 Rbound(string) BarStyleComposer
28 RboundMeta(func(...interface{}) string) BarStyleComposer
2529 Filler(string) BarStyleComposer
30 FillerMeta(func(...interface{}) string) BarStyleComposer
2631 Refiller(string) BarStyleComposer
32 RefillerMeta(func(...interface{}) string) BarStyleComposer
2733 Padding(string) BarStyleComposer
28 TipOnComplete(string) BarStyleComposer
34 PaddingMeta(func(...interface{}) string) BarStyleComposer
2935 Tip(frames ...string) BarStyleComposer
36 TipMeta(func(...interface{}) string) BarStyleComposer
37 TipOnComplete() BarStyleComposer
3038 Reverse() BarStyleComposer
3139 }
3240
3341 type bFiller struct {
34 rev bool
35 components [components]*component
36 tip struct {
37 count uint
38 frames []*component
39 onComplete *component
42 components [components]component
43 meta [components]func(io.Writer, ...interface{}) error
44 rev bool
45 tipOnComplete bool
46 tip struct {
47 frames []component
48 count uint
4049 }
4150 }
4251
4655 }
4756
4857 type barStyle struct {
49 lbound string
50 rbound string
51 filler string
52 refiller string
53 padding string
54 tipOnComplete string
58 style [components]string
59 metaFuncs [components]func(io.Writer, ...interface{}) error
5560 tipFrames []string
61 tipOnComplete bool
5662 rev bool
5763 }
5864
5965 // BarStyle constructs default bar style which can be altered via
6066 // BarStyleComposer interface.
6167 func BarStyle() BarStyleComposer {
62 return &barStyle{
63 lbound: "[",
64 rbound: "]",
65 filler: "=",
66 refiller: "+",
67 padding: "-",
68 tipFrames: []string{">"},
69 }
68 bs := &barStyle{
69 style: defaultBarStyle,
70 tipFrames: []string{defaultBarStyle[iTip]},
71 }
72 defaultMeta := func(w io.Writer, a ...interface{}) (err error) {
73 for i := 0; i < len(a) && err == nil; i++ {
74 _, err = w.Write(a[i].([]byte))
75 }
76 return err
77 }
78 for i := range bs.metaFuncs {
79 bs.metaFuncs[i] = defaultMeta
80 }
81 return bs
7082 }
7183
7284 func (s *barStyle) Lbound(bound string) BarStyleComposer {
73 s.lbound = bound
85 s.style[iLbound] = bound
86 return s
87 }
88
89 func (s *barStyle) LboundMeta(fn func(...interface{}) string) BarStyleComposer {
90 s.metaFuncs[iLbound] = makeMetaFunc(fn)
7491 return s
7592 }
7693
7794 func (s *barStyle) Rbound(bound string) BarStyleComposer {
78 s.rbound = bound
95 s.style[iRbound] = bound
96 return s
97 }
98
99 func (s *barStyle) RboundMeta(fn func(...interface{}) string) BarStyleComposer {
100 s.metaFuncs[iRbound] = makeMetaFunc(fn)
79101 return s
80102 }
81103
82104 func (s *barStyle) Filler(filler string) BarStyleComposer {
83 s.filler = filler
105 s.style[iFiller] = filler
106 return s
107 }
108
109 func (s *barStyle) FillerMeta(fn func(...interface{}) string) BarStyleComposer {
110 s.metaFuncs[iFiller] = makeMetaFunc(fn)
84111 return s
85112 }
86113
87114 func (s *barStyle) Refiller(refiller string) BarStyleComposer {
88 s.refiller = refiller
115 s.style[iRefiller] = refiller
116 return s
117 }
118
119 func (s *barStyle) RefillerMeta(fn func(...interface{}) string) BarStyleComposer {
120 s.metaFuncs[iRefiller] = makeMetaFunc(fn)
89121 return s
90122 }
91123
92124 func (s *barStyle) Padding(padding string) BarStyleComposer {
93 s.padding = padding
94 return s
95 }
96
97 func (s *barStyle) TipOnComplete(tip string) BarStyleComposer {
98 s.tipOnComplete = tip
125 s.style[iPadding] = padding
126 return s
127 }
128
129 func (s *barStyle) PaddingMeta(fn func(...interface{}) string) BarStyleComposer {
130 s.metaFuncs[iPadding] = makeMetaFunc(fn)
99131 return s
100132 }
101133
102134 func (s *barStyle) Tip(frames ...string) BarStyleComposer {
103135 if len(frames) != 0 {
104 s.tipFrames = append(s.tipFrames[:0], frames...)
105 }
136 s.tipFrames = frames
137 }
138 return s
139 }
140
141 func (s *barStyle) TipMeta(fn func(...interface{}) string) BarStyleComposer {
142 s.metaFuncs[iTip] = makeMetaFunc(fn)
143 return s
144 }
145
146 func (s *barStyle) TipOnComplete() BarStyleComposer {
147 s.tipOnComplete = true
106148 return s
107149 }
108150
112154 }
113155
114156 func (s *barStyle) Build() BarFiller {
115 bf := &bFiller{rev: s.rev}
116 bf.components[iLbound] = &component{
117 width: runewidth.StringWidth(stripansi.Strip(s.lbound)),
118 bytes: []byte(s.lbound),
119 }
120 bf.components[iRbound] = &component{
121 width: runewidth.StringWidth(stripansi.Strip(s.rbound)),
122 bytes: []byte(s.rbound),
123 }
124 bf.components[iFiller] = &component{
125 width: runewidth.StringWidth(stripansi.Strip(s.filler)),
126 bytes: []byte(s.filler),
127 }
128 bf.components[iRefiller] = &component{
129 width: runewidth.StringWidth(stripansi.Strip(s.refiller)),
130 bytes: []byte(s.refiller),
131 }
132 bf.components[iPadding] = &component{
133 width: runewidth.StringWidth(stripansi.Strip(s.padding)),
134 bytes: []byte(s.padding),
135 }
136 bf.tip.onComplete = &component{
137 width: runewidth.StringWidth(stripansi.Strip(s.tipOnComplete)),
138 bytes: []byte(s.tipOnComplete),
139 }
140 bf.tip.frames = make([]*component, len(s.tipFrames))
157 bf := &bFiller{
158 meta: s.metaFuncs,
159 rev: s.rev,
160 tipOnComplete: s.tipOnComplete,
161 }
162 bf.components[iLbound] = component{
163 width: runewidth.StringWidth(s.style[iLbound]),
164 bytes: []byte(s.style[iLbound]),
165 }
166 bf.components[iRbound] = component{
167 width: runewidth.StringWidth(s.style[iRbound]),
168 bytes: []byte(s.style[iRbound]),
169 }
170 bf.components[iFiller] = component{
171 width: runewidth.StringWidth(s.style[iFiller]),
172 bytes: []byte(s.style[iFiller]),
173 }
174 bf.components[iRefiller] = component{
175 width: runewidth.StringWidth(s.style[iRefiller]),
176 bytes: []byte(s.style[iRefiller]),
177 }
178 bf.components[iPadding] = component{
179 width: runewidth.StringWidth(s.style[iPadding]),
180 bytes: []byte(s.style[iPadding]),
181 }
182 bf.tip.frames = make([]component, len(s.tipFrames))
141183 for i, t := range s.tipFrames {
142 bf.tip.frames[i] = &component{
143 width: runewidth.StringWidth(stripansi.Strip(t)),
184 bf.tip.frames[i] = component{
185 width: runewidth.StringWidth(t),
144186 bytes: []byte(t),
145187 }
146188 }
155197 return nil
156198 }
157199
158 _, err = w.Write(s.components[iLbound].bytes)
200 err = s.meta[iLbound](w, s.components[iLbound].bytes)
159201 if err != nil {
160202 return err
161203 }
162204
163205 if width == 0 {
164 _, err = w.Write(s.components[iRbound].bytes)
165 return err
166 }
167
168 var filling [][]byte
169 var padding [][]byte
170 var tip *component
171 var filled int
172 var refWidth int
206 return s.meta[iRbound](w, s.components[iRbound].bytes)
207 }
208
209 var tip component
210 var refilling, filling, padding []byte
211 var fillCount, refWidth int
173212 curWidth := int(internal.PercentageRound(stat.Total, stat.Current, uint(width)))
174213
175 if stat.Completed {
176 tip = s.tip.onComplete
177 } else {
214 if curWidth != 0 && !stat.Completed || s.tipOnComplete {
178215 tip = s.tip.frames[s.tip.count%uint(len(s.tip.frames))]
179 }
180
181 if curWidth > 0 {
182 filling = append(filling, tip.bytes)
183 filled += tip.width
184216 s.tip.count++
185 }
186
187 if stat.Refill > 0 {
217 fillCount += tip.width
218 }
219
220 if stat.Refill != 0 {
188221 refWidth = int(internal.PercentageRound(stat.Total, stat.Refill, uint(width)))
189222 curWidth -= refWidth
190223 refWidth += curWidth
191224 }
192225
193 for filled < curWidth {
194 if curWidth-filled >= s.components[iFiller].width {
195 filling = append(filling, s.components[iFiller].bytes)
196 if s.components[iFiller].width == 0 {
197 break
226 for curWidth-fillCount >= s.components[iFiller].width {
227 filling = append(filling, s.components[iFiller].bytes...)
228 fillCount += s.components[iFiller].width
229 }
230
231 for refWidth-fillCount >= s.components[iRefiller].width {
232 refilling = append(refilling, s.components[iRefiller].bytes...)
233 fillCount += s.components[iRefiller].width
234 }
235
236 for width-fillCount >= s.components[iPadding].width {
237 padding = append(padding, s.components[iPadding].bytes...)
238 fillCount += s.components[iPadding].width
239 }
240
241 if width-fillCount != 0 {
242 padding = append(padding, "…"...)
243 }
244
245 err = flush(w, s.rev,
246 flushSection{s.meta[iRefiller], refilling},
247 flushSection{s.meta[iFiller], filling},
248 flushSection{s.meta[iTip], tip.bytes},
249 flushSection{s.meta[iPadding], padding},
250 )
251 if err != nil {
252 return err
253 }
254 return s.meta[iRbound](w, s.components[iRbound].bytes)
255 }
256
257 type flushSection struct {
258 meta func(io.Writer, ...interface{}) error
259 bytes []byte
260 }
261
262 func flush(w io.Writer, rev bool, sections ...flushSection) error {
263 if rev {
264 for i := len(sections) - 1; i >= 0; i-- {
265 s := sections[i]
266 err := s.meta(w, s.bytes)
267 if err != nil {
268 return err
198269 }
199 filled += s.components[iFiller].width
200 } else {
201 filling = append(filling, []byte("…"))
202 filled++
203 }
204 }
205
206 for filled < refWidth {
207 if refWidth-filled >= s.components[iRefiller].width {
208 filling = append(filling, s.components[iRefiller].bytes)
209 if s.components[iRefiller].width == 0 {
210 break
270 }
271 } else {
272 for _, s := range sections {
273 err := s.meta(w, s.bytes)
274 if err != nil {
275 return err
211276 }
212 filled += s.components[iRefiller].width
213 } else {
214 filling = append(filling, []byte("…"))
215 filled++
216 }
217 }
218
219 padWidth := width - filled
220 for padWidth > 0 {
221 if padWidth >= s.components[iPadding].width {
222 padding = append(padding, s.components[iPadding].bytes)
223 if s.components[iPadding].width == 0 {
224 break
225 }
226 padWidth -= s.components[iPadding].width
227 } else {
228 padding = append(padding, []byte("…"))
229 padWidth--
230 }
231 }
232
233 if s.rev {
234 filling, padding = padding, filling
235 }
236 err = flush(w, filling, padding)
237 if err != nil {
238 return err
239 }
240 _, err = w.Write(s.components[iRbound].bytes)
241 return err
242 }
243
244 func flush(w io.Writer, filling, padding [][]byte) error {
245 for i := len(filling) - 1; i >= 0; i-- {
246 _, err := w.Write(filling[i])
247 if err != nil {
248 return err
249 }
250 }
251 for i := 0; i < len(padding); i++ {
252 _, err := w.Write(padding[i])
253 if err != nil {
254 return err
255277 }
256278 }
257279 return nil
258280 }
281
282 func makeMetaFunc(fn func(...interface{}) string) func(io.Writer, ...interface{}) error {
283 return func(w io.Writer, a ...interface{}) (err error) {
284 for i := 0; i < len(a) && err == nil; i++ {
285 _, err = io.WriteString(w, fn(string(a[i].([]byte))))
286 }
287 return err
288 }
289 }
809809 }{
810810 3: {
811811 {
812 style: BarStyle().TipOnComplete(">"),
812 style: BarStyle().TipOnComplete(),
813813 name: "t,c{60,60}",
814814 total: 60,
815815 current: 60,
816816 want: " ",
817817 },
818818 {
819 style: BarStyle().TipOnComplete(">"),
819 style: BarStyle().TipOnComplete(),
820820 name: "t,c{60,60}trim",
821821 total: 60,
822822 current: 60,
826826 },
827827 4: {
828828 {
829 style: BarStyle().TipOnComplete(">"),
829 style: BarStyle().TipOnComplete(),
830830 name: "t,c{60,59}",
831831 total: 60,
832832 current: 59,
833833 want: " [] ",
834834 },
835835 {
836 style: BarStyle().TipOnComplete(">"),
836 style: BarStyle().TipOnComplete(),
837837 name: "t,c{60,59}trim",
838838 total: 60,
839839 current: 59,
841841 want: "[=>]",
842842 },
843843 {
844 style: BarStyle().TipOnComplete(">"),
844 style: BarStyle().TipOnComplete(),
845845 name: "t,c{60,60}",
846846 total: 60,
847847 current: 60,
848848 want: " [] ",
849849 },
850850 {
851 style: BarStyle().TipOnComplete(">"),
851 style: BarStyle().TipOnComplete(),
852852 name: "t,c{60,60}trim",
853853 total: 60,
854854 current: 60,
858858 },
859859 5: {
860860 {
861 style: BarStyle().TipOnComplete(">"),
861 style: BarStyle().TipOnComplete(),
862862 name: "t,c{60,59}",
863863 total: 60,
864864 current: 59,
865865 want: " [>] ",
866866 },
867867 {
868 style: BarStyle().TipOnComplete(">"),
868 style: BarStyle().TipOnComplete(),
869869 name: "t,c{60,59}trim",
870870 total: 60,
871871 current: 59,
873873 want: "[==>]",
874874 },
875875 {
876 style: BarStyle().TipOnComplete(">"),
876 style: BarStyle().TipOnComplete(),
877877 name: "t,c{60,60}",
878878 total: 60,
879879 current: 60,
880880 want: " [>] ",
881881 },
882882 {
883 style: BarStyle().TipOnComplete(">"),
883 style: BarStyle().TipOnComplete(),
884884 name: "t,c{60,60}trim",
885885 total: 60,
886886 current: 60,
890890 },
891891 6: {
892892 {
893 style: BarStyle().TipOnComplete(">"),
893 style: BarStyle().TipOnComplete(),
894894 name: "t,c{60,59}",
895895 total: 60,
896896 current: 59,
897897 want: " [=>] ",
898898 },
899899 {
900 style: BarStyle().TipOnComplete(">"),
900 style: BarStyle().TipOnComplete(),
901901 name: "t,c{60,59}trim",
902902 total: 60,
903903 current: 59,
905905 want: "[===>]",
906906 },
907907 {
908 style: BarStyle().TipOnComplete(">"),
908 style: BarStyle().TipOnComplete(),
909909 name: "t,c{60,60}",
910910 total: 60,
911911 current: 60,
912912 want: " [=>] ",
913913 },
914914 {
915 style: BarStyle().TipOnComplete(">"),
915 style: BarStyle().TipOnComplete(),
916916 name: "t,c{60,60}trim",
917917 total: 60,
918918 current: 60,
922922 },
923923 7: {
924924 {
925 style: BarStyle().TipOnComplete(">"),
925 style: BarStyle().TipOnComplete(),
926926 name: "t,c{60,59}",
927927 total: 60,
928928 current: 59,
929929 want: " [==>] ",
930930 },
931931 {
932 style: BarStyle().TipOnComplete(">"),
932 style: BarStyle().TipOnComplete(),
933933 name: "t,c{60,59}trim",
934934 total: 60,
935935 current: 59,
937937 want: "[====>]",
938938 },
939939 {
940 style: BarStyle().TipOnComplete(">"),
940 style: BarStyle().TipOnComplete(),
941941 name: "t,c{60,60}",
942942 total: 60,
943943 current: 60,
944944 want: " [==>] ",
945945 },
946946 {
947 style: BarStyle().TipOnComplete(">"),
947 style: BarStyle().TipOnComplete(),
948948 name: "t,c{60,60}trim",
949949 total: 60,
950950 current: 60,
954954 },
955955 8: {
956956 {
957 style: BarStyle().TipOnComplete(">"),
957 style: BarStyle().TipOnComplete(),
958958 name: "t,c{60,59}",
959959 total: 60,
960960 current: 59,
961961 want: " [===>] ",
962962 },
963963 {
964 style: BarStyle().TipOnComplete(">"),
964 style: BarStyle().TipOnComplete(),
965965 name: "t,c{60,59}trim",
966966 total: 60,
967967 current: 59,
969969 want: "[=====>]",
970970 },
971971 {
972 style: BarStyle().TipOnComplete(">"),
972 style: BarStyle().TipOnComplete(),
973973 name: "t,c{60,60}",
974974 total: 60,
975975 current: 60,
976976 want: " [===>] ",
977977 },
978978 {
979 style: BarStyle().TipOnComplete(">"),
979 style: BarStyle().TipOnComplete(),
980980 name: "t,c{60,60}trim",
981981 total: 60,
982982 current: 60,
986986 },
987987 80: {
988988 {
989 style: BarStyle().TipOnComplete(">"),
989 style: BarStyle().TipOnComplete(),
990990 name: "t,c{60,59}",
991991 total: 60,
992992 current: 59,
993993 want: " [==========================================================================>-] ",
994994 },
995995 {
996 style: BarStyle().TipOnComplete(">"),
996 style: BarStyle().TipOnComplete(),
997997 name: "t,c{60,59}trim",
998998 total: 60,
999999 current: 59,
10011001 want: "[============================================================================>-]",
10021002 },
10031003 {
1004 style: BarStyle().TipOnComplete(">"),
1004 style: BarStyle().TipOnComplete(),
10051005 name: "t,c,bw{60,59,60}",
10061006 total: 60,
10071007 current: 59,
10091009 want: " [========================================================>-] ",
10101010 },
10111011 {
1012 style: BarStyle().TipOnComplete(">"),
1012 style: BarStyle().TipOnComplete(),
10131013 name: "t,c,bw{60,59,60}trim",
10141014 total: 60,
10151015 current: 59,
10181018 want: "[========================================================>-]",
10191019 },
10201020 {
1021 style: BarStyle().TipOnComplete(">"),
1021 style: BarStyle().TipOnComplete(),
10221022 name: "t,c{60,60}",
10231023 total: 60,
10241024 current: 60,
10251025 want: " [===========================================================================>] ",
10261026 },
10271027 {
1028 style: BarStyle().TipOnComplete(">"),
1028 style: BarStyle().TipOnComplete(),
10291029 name: "t,c{60,60}trim",
10301030 total: 60,
10311031 current: 60,
10331033 want: "[=============================================================================>]",
10341034 },
10351035 {
1036 style: BarStyle().TipOnComplete(">"),
1036 style: BarStyle().TipOnComplete(),
10371037 name: "t,c,bw{60,60,60}",
10381038 total: 60,
10391039 current: 60,
10411041 want: " [=========================================================>] ",
10421042 },
10431043 {
1044 style: BarStyle().TipOnComplete(">"),
1044 style: BarStyle().TipOnComplete(),
10451045 name: "t,c,bw{60,60,60}trim",
10461046 total: 60,
10471047 current: 60,
10521052 },
10531053 99: {
10541054 {
1055 style: BarStyle().TipOnComplete(">"),
1055 style: BarStyle().TipOnComplete(),
10561056 name: "t,c{100,99}",
10571057 total: 100,
10581058 current: 99,
10591059 want: " [=============================================================================================>-] ",
10601060 },
10611061 {
1062 style: BarStyle().TipOnComplete(">"),
1062 style: BarStyle().TipOnComplete(),
10631063 name: "t,c{100,99}trim",
10641064 total: 100,
10651065 current: 99,
10671067 want: "[===============================================================================================>-]",
10681068 },
10691069 {
1070 style: BarStyle().TipOnComplete(">"),
1070 style: BarStyle().TipOnComplete(),
10711071 name: "t,c{100,100}",
10721072 total: 100,
10731073 current: 100,
10741074 want: " [==============================================================================================>] ",
10751075 },
10761076 {
1077 style: BarStyle().TipOnComplete(">"),
1077 style: BarStyle().TipOnComplete(),
10781078 name: "t,c{100,100}trim",
10791079 total: 100,
10801080 current: 100,
10821082 want: "[================================================================================================>]",
10831083 },
10841084 {
1085 style: BarStyle().TipOnComplete(">"),
1085 style: BarStyle().TipOnComplete(),
10861086 name: "t,c,r{100,100,99}",
10871087 total: 100,
10881088 current: 100,
10901090 want: " [++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++>] ",
10911091 },
10921092 {
1093 style: BarStyle().TipOnComplete(">"),
1093 style: BarStyle().TipOnComplete(),
10941094 name: "t,c,r{100,100,99}trim",
10951095 total: 100,
10961096 current: 100,
10991099 want: "[++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++>]",
11001100 },
11011101 {
1102 style: BarStyle().TipOnComplete("<").Reverse(),
1103 name: `t,c,r{100,100,99}TipOnComplete("<").Reverse()`,
1102 style: BarStyle().Tip("<").TipOnComplete().Reverse(),
1103 name: `t,c,r{100,100,99}.Tip("<").TipOnComplete().Reverse()`,
11041104 total: 100,
11051105 current: 100,
11061106 refill: 99,
11071107 want: " [<++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++] ",
11081108 },
11091109 {
1110 style: BarStyle().TipOnComplete("<").Reverse(),
1111 name: `t,c,r{100,100,99}TipOnComplete("<").Reverse()trim`,
1110 style: BarStyle().Tip("<").TipOnComplete().Reverse(),
1111 name: `t,c,r{100,100,99}.Tip("<").TipOnComplete().Reverse()trim`,
11121112 total: 100,
11131113 current: 100,
11141114 refill: 99,
11161116 want: "[<++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++]",
11171117 },
11181118 {
1119 style: BarStyle().TipOnComplete(">"),
1119 style: BarStyle().TipOnComplete(),
11201120 name: "t,c,r{100,100,100}",
11211121 total: 100,
11221122 current: 100,
11241124 want: " [++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++>] ",
11251125 },
11261126 {
1127 style: BarStyle().TipOnComplete(">"),
1127 style: BarStyle().TipOnComplete(),
11281128 name: "t,c,r{100,100,100}trim",
11291129 total: 100,
11301130 current: 100,
11331133 want: "[++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++>]",
11341134 },
11351135 {
1136 style: BarStyle().TipOnComplete("<").Reverse(),
1137 name: `t,c,r{100,100,100}TipOnComplete("<").Reverse()`,
1136 style: BarStyle().Tip("<").TipOnComplete().Reverse(),
1137 name: `t,c,r{100,100,100}.Tip("<").TipOnComplete().Reverse()`,
11381138 total: 100,
11391139 current: 100,
11401140 refill: 100,
11411141 want: " [<++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++] ",
11421142 },
11431143 {
1144 style: BarStyle().TipOnComplete("<").Reverse(),
1145 name: `t,c,r{100,100,100}TipOnComplete("<").Reverse()trim`,
1144 style: BarStyle().Tip("<").TipOnComplete().Reverse(),
1145 name: `t,c,r{100,100,100}.Tip("<").TipOnComplete().Reverse()trim`,
11461146 total: 100,
11471147 current: 100,
11481148 refill: 100,
11521152 },
11531153 100: {
11541154 {
1155 style: BarStyle().TipOnComplete(">"),
1155 style: BarStyle().TipOnComplete(),
11561156 name: "t,c{100,99}",
11571157 total: 100,
11581158 current: 99,
11591159 want: " [==============================================================================================>-] ",
11601160 },
11611161 {
1162 style: BarStyle().TipOnComplete(">"),
1162 style: BarStyle().TipOnComplete(),
11631163 name: "t,c{100,99}trim",
11641164 total: 100,
11651165 current: 99,
11671167 want: "[================================================================================================>-]",
11681168 },
11691169 {
1170 style: BarStyle().TipOnComplete(">"),
1170 style: BarStyle().TipOnComplete(),
11711171 name: "t,c{100,100}",
11721172 total: 100,
11731173 current: 100,
11741174 want: " [===============================================================================================>] ",
11751175 },
11761176 {
1177 style: BarStyle().TipOnComplete(">"),
1177 style: BarStyle().TipOnComplete(),
11781178 name: "t,c{100,100}trim",
11791179 total: 100,
11801180 current: 100,
11821182 want: "[=================================================================================================>]",
11831183 },
11841184 {
1185 style: BarStyle().TipOnComplete(">"),
1185 style: BarStyle().TipOnComplete(),
11861186 name: "t,c,r{100,100,99}",
11871187 total: 100,
11881188 current: 100,
11901190 want: " [+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++>] ",
11911191 },
11921192 {
1193 style: BarStyle().TipOnComplete(">"),
1193 style: BarStyle().TipOnComplete(),
11941194 name: "t,c,r{100,100,99}trim",
11951195 total: 100,
11961196 current: 100,
11991199 want: "[+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++>]",
12001200 },
12011201 {
1202 style: BarStyle().TipOnComplete(">"),
1202 style: BarStyle().TipOnComplete(),
12031203 name: "t,c,r{100,100,100}",
12041204 total: 100,
12051205 current: 100,
12071207 want: " [+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++>] ",
12081208 },
12091209 {
1210 style: BarStyle().TipOnComplete(">"),
1210 style: BarStyle().TipOnComplete(),
12111211 name: "t,c,r{100,100,100}trim",
12121212 total: 100,
12131213 current: 100,
13131313 want: " [===============================================================================================] ",
13141314 },
13151315 {
1316 style: BarStyle().TipOnComplete("だ"),
1317 name: `t,c{100,100}TipOnComplete("だ")`,
1316 style: BarStyle().Tip("だ").TipOnComplete(),
1317 name: `t,c{100,100}.Tip("だ").TipOnComplete()`,
13181318 total: 100,
13191319 current: 100,
13201320 want: " [=============================================================================================だ] ",
13551355 want: " [ののののののののののののののののののののののののののののののののののののののののののののののの…] ",
13561356 },
13571357 {
1358 style: BarStyle().Filler("の").Tip("だ").TipOnComplete("だ").Padding("つ"),
1359 name: `t,c{100,99}Filler("の").Tip("だ").TipOnComplete("だ").Padding("つ")`,
1358 style: BarStyle().Filler("の").Tip("だ").TipOnComplete().Padding("つ"),
1359 name: `t,c{100,99}Filler("の").Tip("だ").TipOnComplete().Padding("つ")`,
13601360 total: 100,
13611361 current: 99,
13621362 want: " [ののののののののののののののののののののののののののののののののののののののののののののののだ…] ",
13631363 },
13641364 {
1365 style: BarStyle().Filler("の").Tip("だ").TipOnComplete("だ").Padding("つ"),
1366 name: `t,c{100,100}.Filler("の").Tip("だ").TipOnComplete("だ").Padding("つ")`,
1365 style: BarStyle().Filler("の").Tip("だ").TipOnComplete().Padding("つ"),
1366 name: `t,c{100,100}.Filler("の").Tip("だ").TipOnComplete().Padding("つ")`,
13671367 total: 100,
13681368 current: 100,
13691369 want: " […ののののののののののののののののののののののののののののののののののののののののののののののだ] ",
13701370 },
13711371 {
1372 style: BarStyle().Filler("の").Tip("だ").TipOnComplete("だ").Padding("つ").Reverse(),
1373 name: `t,c{100,100}.Filler("の").Tip("だ").TipOnComplete("だ").Padding("つ").Reverse()`,
1372 style: BarStyle().Filler("の").Tip("だ").TipOnComplete().Padding("つ").Reverse(),
1373 name: `t,c{100,100}.Filler("の").Tip("だ").TipOnComplete().Padding("つ").Reverse()`,
13741374 total: 100,
13751375 current: 100,
13761376 want: " [だのののののののののののののののののののののののののののののののののののののののののののののの…] ",