Skip to content

Commit

Permalink
info: add json func to get info struct as json string directly
Browse files Browse the repository at this point in the history
  • Loading branch information
colindickson committed Sep 20, 2023
1 parent a0bc31b commit ffd191a
Showing 1 changed file with 14 additions and 0 deletions.
14 changes: 14 additions & 0 deletions info/info.go
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
package info

import (
"encoding/json"
"fmt"
"github.com/streamingfast/substreams/manifest"
"github.com/streamingfast/substreams/pipeline/outputmodules"
Expand Down Expand Up @@ -186,6 +187,19 @@ func Info(manifestPath string, opts ...InfoOption) (*ManifestInfo, error) {
return manifestInfo, nil
}

func InfoJson(manifestPath string, opts ...InfoOption) (string, error) {
info, err := Info(manifestPath, opts...)
if err != nil {
return "", err
}

res, err := json.MarshalIndent(info, "", " ")
if err != nil {
return "", err
}
return string(res), nil
}

func strPtr(s string) *string {
return &s
}

0 comments on commit ffd191a

Please sign in to comment.