MCPcopy Create free account
hub / github.com/box-cli-maker/box-cli-maker / main

Function main

examples/readme/main.go:25–48  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

23)
24
25func main() {
26 b := box.NewBox().
27 Style(box.Round).
28 Padding(2, 2).
29 TitlePosition(box.Top).
30 ContentAlign(box.Left).
31 Color(colorBorderPrimary).
32 TitleColor(colorTitlePrimary)
33
34 lines := []string{
35 "• " + accent("9 styles", colorBorderSoft) + " (Single, Double, Round, Bold, etc.)",
36 "• " + accent("Typed API", colorTitlePrimary) + " BoxStyle / TitlePosition / AlignType",
37 "• " + accent("Custom styles", colorBorderDeep) + " Corner/edge glyphs + Copy()",
38 "• " + accent("Titles", colorContentPrimary) + " Inside • Top • Bottom",
39 "• " + accent("Align", colorContentPrimary) + " Left • Center • Right",
40 "• " + accent("Wrapping", colorBorderSoft) + " WrapContent + WrapLimit",
41 "• " + accent("Colors", colorContentSoft) + " ANSI names, hex, rgb/rgba",
42 "• " + accent("Unicode & emoji", colorContentPrimary) + " мир",
43 "• " + accent("Render / MustRender", colorBorderDeep) + " explicit error handling",
44 }
45
46 content := strings.Join(lines, "\n")
47 fmt.Println(b.MustRender("Box CLI Maker", content))
48}
49
50func accent(text, hex string) string {
51 c := ansi.XParseColor(hex)

Callers

nothing calls this directly

Calls 8

accentFunction · 0.85
TitleColorMethod · 0.80
ColorMethod · 0.80
ContentAlignMethod · 0.80
TitlePositionMethod · 0.80
PaddingMethod · 0.80
StyleMethod · 0.80
MustRenderMethod · 0.80

Tested by

no test coverage detected