Skip to content

Commit 9d2d890

Browse files
committed
add easy symbol wrapper
1 parent 3321a73 commit 9d2d890

File tree

1 file changed

+62
-0
lines changed

1 file changed

+62
-0
lines changed

tw/symbols.go

Lines changed: 62 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -327,3 +327,65 @@ func (s *SymbolMerger) BottomRight() string { return s.corners[8] }
327327
func (s *SymbolMerger) HeaderLeft() string { return s.MidLeft() }
328328
func (s *SymbolMerger) HeaderMid() string { return s.Center() }
329329
func (s *SymbolMerger) HeaderRight() string { return s.MidRight() }
330+
331+
// SymbolCustom implements the Symbols interface with fully configurable symbols
332+
type SymbolCustom struct {
333+
name string
334+
center string
335+
row string
336+
column string
337+
topLeft string
338+
topMid string
339+
topRight string
340+
midLeft string
341+
midRight string
342+
bottomLeft string
343+
bottomMid string
344+
bottomRight string
345+
headerLeft string
346+
headerMid string
347+
headerRight string
348+
}
349+
350+
// NewSymbolCustom creates a new customizable border style
351+
func NewSymbolCustom(name string) *SymbolCustom {
352+
return &SymbolCustom{
353+
name: name,
354+
center: "+",
355+
row: "-",
356+
column: "|",
357+
}
358+
}
359+
360+
// Implement all Symbols interface methods
361+
func (c *SymbolCustom) Name() string { return c.name }
362+
func (c *SymbolCustom) Center() string { return c.center }
363+
func (c *SymbolCustom) Row() string { return c.row }
364+
func (c *SymbolCustom) Column() string { return c.column }
365+
func (c *SymbolCustom) TopLeft() string { return c.topLeft }
366+
func (c *SymbolCustom) TopMid() string { return c.topMid }
367+
func (c *SymbolCustom) TopRight() string { return c.topRight }
368+
func (c *SymbolCustom) MidLeft() string { return c.midLeft }
369+
func (c *SymbolCustom) MidRight() string { return c.midRight }
370+
func (c *SymbolCustom) BottomLeft() string { return c.bottomLeft }
371+
func (c *SymbolCustom) BottomMid() string { return c.bottomMid }
372+
func (c *SymbolCustom) BottomRight() string { return c.bottomRight }
373+
func (c *SymbolCustom) HeaderLeft() string { return c.headerLeft }
374+
func (c *SymbolCustom) HeaderMid() string { return c.headerMid }
375+
func (c *SymbolCustom) HeaderRight() string { return c.headerRight }
376+
377+
// Builder methods for fluent configuration
378+
func (c *SymbolCustom) WithCenter(s string) *SymbolCustom { c.center = s; return c }
379+
func (c *SymbolCustom) WithRow(s string) *SymbolCustom { c.row = s; return c }
380+
func (c *SymbolCustom) WithColumn(s string) *SymbolCustom { c.column = s; return c }
381+
func (c *SymbolCustom) WithTopLeft(s string) *SymbolCustom { c.topLeft = s; return c }
382+
func (c *SymbolCustom) WithTopMid(s string) *SymbolCustom { c.topMid = s; return c }
383+
func (c *SymbolCustom) WithTopRight(s string) *SymbolCustom { c.topRight = s; return c }
384+
func (c *SymbolCustom) WithMidLeft(s string) *SymbolCustom { c.midLeft = s; return c }
385+
func (c *SymbolCustom) WithMidRight(s string) *SymbolCustom { c.midRight = s; return c }
386+
func (c *SymbolCustom) WithBottomLeft(s string) *SymbolCustom { c.bottomLeft = s; return c }
387+
func (c *SymbolCustom) WithBottomMid(s string) *SymbolCustom { c.bottomMid = s; return c }
388+
func (c *SymbolCustom) WithBottomRight(s string) *SymbolCustom { c.bottomRight = s; return c }
389+
func (c *SymbolCustom) WithHeaderLeft(s string) *SymbolCustom { c.headerLeft = s; return c }
390+
func (c *SymbolCustom) WithHeaderMid(s string) *SymbolCustom { c.headerMid = s; return c }
391+
func (c *SymbolCustom) WithHeaderRight(s string) *SymbolCustom { c.headerRight = s; return c }

0 commit comments

Comments
 (0)