diff options
| author | s <[email protected]> | 2025-11-13 14:43:15 -0500 |
|---|---|---|
| committer | s <[email protected]> | 2025-11-13 14:43:15 -0500 |
| commit | 344a6f6415c3c1b593677adec3b8844e0839971b (patch) | |
| tree | b05291ecdf21917b27e9e234eeb997c2706966d5 /internal/formatter/bssid.go | |
| parent | a5fc01a03753c9a18ddeaf13610dd99b4b311b80 (diff) | |
| download | dborg-344a6f6415c3c1b593677adec3b8844e0839971b.tar.gz dborg-344a6f6415c3c1b593677adec3b8844e0839971b.zip | |
created pretty printing for all commandsv1.0.0
Diffstat (limited to 'internal/formatter/bssid.go')
| -rw-r--r-- | internal/formatter/bssid.go | 47 |
1 files changed, 47 insertions, 0 deletions
diff --git a/internal/formatter/bssid.go b/internal/formatter/bssid.go new file mode 100644 index 0000000..06aa3cc --- /dev/null +++ b/internal/formatter/bssid.go @@ -0,0 +1,47 @@ +package formatter + +import ( + "fmt" + + "git.db.org.ai/dborg/internal/models" + "git.db.org.ai/dborg/internal/utils" +) + +func FormatBSSIDResults(response models.BSSIDLookupResponse, asJSON bool) error { + if asJSON { + return utils.PrintJSON(response) + } + + if len(response) == 0 { + PrintWarning("No results found") + return nil + } + + PrintSection("BSSID Lookup Results") + + for i, result := range response { + if i > 0 { + PrintDivider() + } + + fmt.Printf("\n%s: %s\n", Cyan("BSSID"), Bold(result.BSSID)) + + if result.Location != nil { + fmt.Printf("%s: %s\n", Cyan("Latitude"), Yellow(fmt.Sprintf("%.6f", result.Location.Latitude))) + fmt.Printf("%s: %s\n", Cyan("Longitude"), Yellow(fmt.Sprintf("%.6f", result.Location.Longitude))) + fmt.Printf("%s: %s\n", Cyan("Accuracy"), Dim(fmt.Sprintf("%d meters", result.Location.Accuracy))) + + if result.GoogleMap != "" { + fmt.Printf("%s: %s\n", Cyan("Google Maps"), result.GoogleMap) + } + if result.OpenStreetMap != "" { + fmt.Printf("%s: %s\n", Cyan("OpenStreetMap"), result.OpenStreetMap) + } + } else { + fmt.Printf("%s\n", Gray("No location data available")) + } + } + + fmt.Println() + return nil +} |
