mise cool
This commit is contained in:
23
cmd/run.go
23
cmd/run.go
@@ -5,6 +5,7 @@ import (
|
|||||||
"encoding/json"
|
"encoding/json"
|
||||||
"fmt"
|
"fmt"
|
||||||
"os"
|
"os"
|
||||||
|
"path"
|
||||||
)
|
)
|
||||||
|
|
||||||
func Run(ctx context.Context) error {
|
func Run(ctx context.Context) error {
|
||||||
@@ -18,7 +19,27 @@ func Run(ctx context.Context) error {
|
|||||||
return err
|
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)
|
fmt.Printf("%s\n", b)
|
||||||
|
|
||||||
return ctx.Err()
|
return ctx.Err()
|
||||||
|
|||||||
@@ -2,4 +2,10 @@
|
|||||||
GOOGLE_PLACES_API_KEY = "AIzaSyBkACm-LQkoSfsTO5_XAzBVZE9-JQzcNkg"
|
GOOGLE_PLACES_API_KEY = "AIzaSyBkACm-LQkoSfsTO5_XAzBVZE9-JQzcNkg"
|
||||||
|
|
||||||
[tasks.default]
|
[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 ./ "
|
||||||
|
|||||||
Reference in New Issue
Block a user