Box CLI Maker v3.0.0
Box CLI Maker v3 introduces a modern, fluent API and moves to the box-cli-maker organisation!
What's New
Module path: github.com/box-cli-maker/box-cli-maker/v3
Fluent, Chainable API
b := box.NewBox().
Style(box.Single).
Padding(2, 1).
TitlePosition(box.Top).
ContentAlign(box.Center).
Color(box.Cyan).
TitleColor(box.BrightYellow)
fmt.Println(b.MustRender("Box CLI Maker", "Render highly customizable boxes\n in the terminal"))Key Highlights
- Fluent API - Clean method chaining replaces struct-based configuration
- Type safety - Compile-time constants (
box.Single,box.Center) instead of strings - New Block style - 9 built-in styles including solid block characters
- Better error handling -
Render()returns errors,MustRender()panics on error - Box copying -
.Copy()method for creating derived configurations - Enhanced colors - Support for ANSI names,
#RGB,#RRGGBB, and XParseColor formats - Custom glyphs - Individual setters for each border element
- Active maintenance - Ongoing development under new organization
Breaking Changes
This is a major version with breaking changes from v2:
| v2 | v3 |
|---|---|
box.New(box.Config{...}) |
box.NewBox().Style(...).Padding(...) |
Type: "Single" |
.Style(box.Single) |
b.String("Title", "Content") |
b.MustRender("Title", "Content") |
b.Print(), b.Println() |
fmt.Println(b.MustRender(...)) |
See the Migration Guide for complete upgrade instructions.
Installation
go get github.com/box-cli-maker/box-cli-maker/v3Resources
- Migration Guide - Step-by-step upgrade instructions
- API Documentation
- Examples - Sample code for all features and usages
Acknowledgements
This release wouldn't have been possible without @meowgorithm, @nedpals, @dipankardas011, @Taz03 and @Gaurav-Gosain's help and guidance
