diff options
Diffstat (limited to 'internal/formatter/crypto.go')
| -rw-r--r-- | internal/formatter/crypto.go | 39 |
1 files changed, 39 insertions, 0 deletions
diff --git a/internal/formatter/crypto.go b/internal/formatter/crypto.go new file mode 100644 index 0000000..70ef29b --- /dev/null +++ b/internal/formatter/crypto.go @@ -0,0 +1,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 +} |
