-
Notifications
You must be signed in to change notification settings - Fork 1
/
boxes.go
56 lines (47 loc) · 1.09 KB
/
boxes.go
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
package ui
import (
box "github.com/Delta456/box-cli-maker/v2"
"github.com/pterm/pterm"
)
var (
titleBox = box.New(box.Config{
Type: "Double",
Color: "HiMagenta",
ContentAlign: "Center",
TitlePos: "Inside",
Px: 3,
Py: 0,
})
contentsBox = box.New(box.Config{
Type: "Round",
Color: "White",
ContentAlign: "Center",
TitlePos: "Top",
Px: 2,
Py: 1,
})
compactBox = box.New(box.Config{
Type: "Round",
Color: "White",
ContentAlign: "Center",
TitlePos: "Inside",
Px: 2,
Py: 0,
})
)
const maxLineLength int = 60
func stringToParagraph(in string) string {
return pterm.DefaultParagraph.WithMaxWidth(maxLineLength).Sprint(in)
}
func PrintTitleBox(title, sub string) {
stopUIElements()
titleBox.Println(title, stringToParagraph(sub))
}
func PrintBox(title, sub string) {
stopUIElements()
contentsBox.Println(title, stringToParagraph(sub))
}
func PrintCompactBox(title, sub string) {
stopUIElements()
compactBox.Println(title, stringToParagraph(sub))
}