Delta456 / box-cli-maker

Make Highly Customized Boxes for CLI
MIT License
537 stars 23 forks source link

[IMP] Breaking changes in v3 release #26

Open Delta456 opened 2 years ago

Delta456 commented 2 years ago

As I was a newbie who started this project 2 years ago. I had made tons of mistakes by doing an initial release v1.0.0 instead of v0.0.1 as I thought it would be fine but now after gaining experience it seems like I will have to do some major changes.

As a library, one must never print to os.Stderr, instead of doing that one must return an err and let the user handle it plus Color field would be renamed to BoxColor so that it will be consistent to TitleColor and ContentColor:

package main

import "github.com/Delta456/box-cli-maker/v3"
import "log"

func main() {
 Box := box.New(box.Config{Px: 2, Py: 5, Type: "Single", BoxColor: "Cyan"})
 err := Box.Print("Box CLI Maker", "Highly Customized Terminal Box Maker")
   if err != nil {
   log.Fatal(err)
   }
}

Most of the panics for unknown Color types will also be changed probably to err so that the user can handle those too.

Warnings like Unknown Color Terminal Profile, Unknown Alignment provided etc will also be changed to err, though the Box will still be created successfully with default settings.

If there are any more changes needed then I will also add those too.

Delta456 commented 2 years ago

I am also hoping to remove https://github.com/Delta456/box-cli-maker/blob/master/detect_windows.go#L20-L27 and https://github.com/Delta456/box-cli-maker/blob/master/detect_unix.go#L18-L25 for good.

Delta456 commented 4 months ago

I am now more well-versed in deciding the design. I am trying to follow the API design of charmbracelet/lipgloss and cahrmbracelete/huh.