Skip to content

Commit

Permalink
feat: return rich json with 'gen json' (#655)
Browse files Browse the repository at this point in the history
  • Loading branch information
moul authored Apr 13, 2023
1 parent c4da50f commit 6deccbc
Showing 1 changed file with 7 additions and 5 deletions.
12 changes: 7 additions & 5 deletions pkg/dvcore/gen.go
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@ package dvcore
import (
"context"
"encoding/csv"
"encoding/json"
"fmt"
"os"
"sync"
Expand All @@ -17,6 +16,7 @@ import (
"moul.io/depviz/v3/pkg/dvparser"
"moul.io/depviz/v3/pkg/dvstore"
"moul.io/depviz/v3/pkg/githubprovider"
"moul.io/godev"
"moul.io/graphman"
"moul.io/graphman/viz"
"moul.io/multipmuri"
Expand Down Expand Up @@ -288,11 +288,13 @@ func graphmanPertConfig(tasks []dvmodel.Task, opts GenOpts) *graphman.PertConfig
}

func genJSON(tasks []dvmodel.Task) error {
out, err := json.MarshalIndent(tasks, "", " ")
if err != nil {
return err
batch := &dvmodel.Batch{}
for _, task := range tasks {
t := task
batch.Tasks = append(batch.Tasks, &t)
}
fmt.Println(string(out))
out := godev.PrettyJSONPB(batch)
fmt.Println(out)
return nil
}

Expand Down

0 comments on commit 6deccbc

Please sign in to comment.