summaryrefslogtreecommitdiffstats
path: root/cmd/geo.go
diff options
context:
space:
mode:
authors <[email protected]>2025-11-13 22:25:02 -0500
committers <[email protected]>2025-11-13 22:25:02 -0500
commit07662d9403eb85b39e1ffcf91014bbf36efd1c5a (patch)
tree1181435223899bae039a947c5fc4fdeec085f91b /cmd/geo.go
parent239936e87183a10a33ce593709eb16c92a04af98 (diff)
downloaddborg-1.0.1.tar.gz
dborg-1.0.1.zip
refactor: break down large osint.go file into separate command modules and add helper functionsv1.0.1
Diffstat (limited to 'cmd/geo.go')
-rw-r--r--cmd/geo.go46
1 files changed, 46 insertions, 0 deletions
diff --git a/cmd/geo.go b/cmd/geo.go
new file mode 100644
index 0000000..6c7caf9
--- /dev/null
+++ b/cmd/geo.go
@@ -0,0 +1,46 @@
+package cmd
+
+import (
+ "git.db.org.ai/dborg/internal/formatter"
+ "git.db.org.ai/dborg/internal/models"
+ "github.com/spf13/cobra"
+)
+
+var geoCmd = &cobra.Command{
+ Use: "geo",
+ Short: "Search for address information",
+ Long: `Returns address information including residents, property details, and demographics (costs 1 credit)`,
+ RunE: runGeoSearch,
+}
+
+func init() {
+ rootCmd.AddCommand(geoCmd)
+ geoCmd.Flags().StringP("street", "s", "", "Street address")
+ geoCmd.Flags().StringP("city", "c", "", "City")
+ geoCmd.Flags().StringP("state", "t", "", "State (2-letter code)")
+ geoCmd.Flags().StringP("zip", "z", "", "ZIP code")
+ geoCmd.MarkFlagRequired("street")
+ geoCmd.MarkFlagRequired("city")
+ geoCmd.MarkFlagRequired("state")
+ geoCmd.MarkFlagRequired("zip")
+}
+
+func runGeoSearch(cmd *cobra.Command, args []string) error {
+ c, err := newClient()
+ if err != nil {
+ return err
+ }
+
+ params := &models.GeoSearchParams{}
+ params.Street, _ = cmd.Flags().GetString("street")
+ params.City, _ = cmd.Flags().GetString("city")
+ params.State, _ = cmd.Flags().GetString("state")
+ params.Zip, _ = cmd.Flags().GetString("zip")
+
+ response, err := c.SearchGeo(params)
+ if err != nil {
+ return err
+ }
+
+ return formatter.FormatGeoResults(*response, IsJSONOutput())
+}