From 2662e056e028d6cc4709999b4d0d3e6c7a0fe7c3 Mon Sep 17 00:00:00 2001 From: bel Date: Sun, 8 Mar 2026 23:55:40 -0600 Subject: [PATCH] mise cool --- cmd/run.go | 23 ++++++++++++++++++++++- mise.toml | 8 +++++++- 2 files changed, 29 insertions(+), 2 deletions(-) diff --git a/cmd/run.go b/cmd/run.go index e0e4bb0..1dcd98b 100644 --- a/cmd/run.go +++ b/cmd/run.go @@ -5,6 +5,7 @@ import ( "encoding/json" "fmt" "os" + "path" ) func Run(ctx context.Context) error { @@ -18,7 +19,27 @@ func Run(ctx context.Context) error { return err } - b, _ := json.Marshal(results) + type geoJson struct { + Type string `json:"type"` + Properties struct { + Name string `json:"name"` + } `json:"properties"` + Geometry struct { + Type string `json:"type"` + Coordinates []float64 `json:"coordinates"` + } `json:"geometry"` + } + geoJsons := make([]geoJson, len(results)) + for i := range results { + geoJsons[i].Type = "Feature" + geoJsons[i].Properties.Name = path.Join(os.Args[2], results[i].Name) + geoJsons[i].Geometry.Type = "Point" + geoJsons[i].Geometry.Coordinates = []float64{results[i].Lng, results[i].Lat} + } + b, _ := json.Marshal(map[string]any{ + "features": geoJsons, + "type": "FeatureCollection", + }) fmt.Printf("%s\n", b) return ctx.Err() diff --git a/mise.toml b/mise.toml index 72f87e0..e658dd7 100644 --- a/mise.toml +++ b/mise.toml @@ -2,4 +2,10 @@ GOOGLE_PLACES_API_KEY = "AIzaSyBkACm-LQkoSfsTO5_XAzBVZE9-JQzcNkg" [tasks.default] -run = "cd \"${MISE_PROJECT_ROOT}\"; go run ./ 'olympia, wa' 'schools'" +run = "mise run olympia -- \"schools\"" + +[tasks.olympia] +run = "mise run search -- \"olympia, wa\"" + +[tasks.search] +run = "cd \"${MISE_PROJECT_ROOT}\"; go run ./ "