blob: 70ef29b51d2a54cd4ec24e1e2653edd28308c89b (
plain)
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
|
package formatter
import (
"fmt"
"git.db.org.ai/dborg/internal/models"
"git.db.org.ai/dborg/internal/utils"
"strings"
)
func FormatCryptoResults(response *models.CryptoResponse, asJSON bool) error {
if asJSON {
return utils.PrintJSON(response)
}
PrintSection(fmt.Sprintf("📊 Crypto Analysis Results"))
if response.Query != "" {
fmt.Printf("%s: %s\n\n", Cyan("Query"), response.Query)
}
if response.Response != "" {
fmt.Println(response.Response)
fmt.Println()
}
PrintDivider()
fmt.Printf("%s: ", Cyan("Credits Remaining"))
if response.Credits.Unlimited {
fmt.Printf("%s\n", Green("Unlimited"))
} else {
fmt.Printf("%s\n", FormatCredits(int64(response.Credits.Remaining)))
}
if response.Message != "" && !strings.Contains(strings.ToLower(response.Message), "success") {
fmt.Printf("\n%s: %s\n", Yellow("Message"), response.Message)
}
return nil
}
|