-
Notifications
You must be signed in to change notification settings - Fork 0
/
helpers.go
37 lines (30 loc) · 905 Bytes
/
helpers.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
package swissknife
import (
"encoding/json"
"fmt"
"log"
"github.com/common-nighthawk/go-figure"
"github.com/fatih/color"
)
const introMessage = "If you have a bit of extra coin, you can drop the developer a coffee.\n" +
"So that he gets drunk on coffee and happily runs to develop this and other projects"
const previewColor = "green"
// PrintIntroMessage - publishes a funny message in the log asking to donate to the developer
func PrintIntroMessage(appName, cryptoAddress string, cryptoCoinTag ...string) {
coinTag := ""
if len(cryptoCoinTag) > 0 {
coinTag = cryptoCoinTag[0]
}
figure.NewColorFigure(appName, "", previewColor, true).Print()
fmt.Println()
fmt.Println(introMessage)
color.Green(cryptoAddress + " " + coinTag)
fmt.Println()
}
func PrintObject(o any) {
data, err := json.MarshalIndent(o, "", " ")
if err != nil {
log.Fatalln(err)
}
fmt.Println(string(data))
}