@@ -25,7 +25,7 @@ type Box struct {
2525 BottomRight string // BottomRight corner used for Symbols
2626 BottomLeft string // BotromLeft corner used for Symbols
2727 Horizontal string // Symbols used for Horizontal Bars
28- Con Config // Config for Box struct
28+ Con Config // Config for the Box struct
2929}
3030
3131// Config is the configuration for the Box struct
@@ -57,7 +57,7 @@ func (b Box) String(title, lines string) string {
5757 if b .Con .TitlePos == "" {
5858 b .Con .TitlePos = "Inside"
5959 }
60-
60+ // if Title is empty then TitlePos should be Inside
6161 if title != "" {
6262 if b .Con .TitlePos != "Inside" && strings .Contains (title , "\n " ) {
6363 panic ("Multilines are only supported inside only" )
@@ -71,7 +71,7 @@ func (b Box) String(title, lines string) string {
7171 return b .toString (title , lines2 )
7272}
7373
74- // toString is same as String except this is for printing Boxes
74+ // toString is same as String except that it is used for printing Boxes
7575func (b Box ) toString (title string , lines []string ) string {
7676 titleLen := len (strings .Split (title , n1 ))
7777 sideMargin := strings .Repeat (" " , b .Con .Px )
@@ -98,7 +98,7 @@ func (b Box) toString(title string, lines []string) string {
9898 } else if b .Con .TitlePos == "Bottom" {
9999 BottomBar = b .BottomLeft + TitleBar + b .BottomRight
100100 } else {
101- fmt .Fprintln (os .Stderr , "Invalid TitlePos provided, using default" )
101+ fmt .Fprintln (os .Stderr , color . RedString ( "[error]: invalid value provided for TitlePos , using default") )
102102 }
103103 }
104104
@@ -115,12 +115,12 @@ func (b Box) toString(title string, lines []string) string {
115115 TopBar = Style (TopBar )
116116 BottomBar = Style (BottomBar )
117117 } else {
118- fmt .Fprintln (os .Stderr , "Invalid Color Type provided, using default color" )
118+ fmt .Fprintln (os .Stderr , color . RedString ( "[error]: invalid value provided to Color , using default" ) )
119119 }
120120 }
121121
122122 if b .Con .TitlePos == "Inside" && runewidth .StringWidth (TopBar ) != runewidth .StringWidth (BottomBar ) {
123- panic ("Cannot create a Box with different sizes of Top and Bottom Bars" )
123+ panic ("cannot create a Box with different sizes of Top and Bottom Bars" )
124124 }
125125
126126 // create lines to print
@@ -156,7 +156,7 @@ func (b Box) toString(title string, lines []string) string {
156156 if i < titleLen && title != "" {
157157 format = centerAlign
158158 }
159-
159+ // obtain color
160160 sep := b .obtainColor ()
161161
162162 // TODO: find a better way
@@ -179,7 +179,7 @@ func (b Box) obtainColor() string {
179179 Style := color .New (fgColors [b .Con .Color ]).SprintfFunc ()
180180 return Style (b .Vertical )
181181 }
182- fmt .Fprintln (os .Stderr , "Invalid Color Type provided, using default color" )
182+ fmt .Fprintln (os .Stderr , color . RedString ( "[error]: invalid value provided to Color , using default" ) )
183183 return b .Vertical
184184}
185185
@@ -191,7 +191,7 @@ func (b Box) Print(title, lines string) {
191191 if b .Con .TitlePos == "" {
192192 b .Con .TitlePos = "Inside"
193193 }
194-
194+ // if Title is empty then TitlePos should be Inside
195195 if title != "" {
196196 if b .Con .TitlePos != "Inside" && strings .Contains (title , "\n " ) {
197197 panic ("Multilines are only supported inside only" )
@@ -213,7 +213,7 @@ func (b Box) Println(title, lines string) {
213213 if b .Con .TitlePos == "" {
214214 b .Con .TitlePos = "Inside"
215215 }
216-
216+ // if Title is empty then TitlePos should be Inside
217217 if title != "" {
218218 if b .Con .TitlePos != "Inside" && strings .Contains (title , "\n " ) {
219219 panic ("Multilines are only supported inside only" )
0 commit comments