feat(): updating array to json

pull/6096/head^2
Art Begolli 6 years ago
parent f3d57f6f24
commit b27d6bb910

@ -59,6 +59,10 @@ type ResultEntry struct {
Description string `json:"description"`
}
type Results struct {
SearchResults []ResultEntry `json:"searchResults"`
}
func newSearchCmd(out io.Writer) *cobra.Command {
sc := &searchCmd{out: out}
@ -171,7 +175,7 @@ func (s *searchCmd) formatSearchResultsJson(res []*search.Result, colWidth uint)
}
resultJson = append(resultJson, resultRow)
}
json, err := json.MarshalIndent(resultJson, "", " ")
json, err := json.MarshalIndent(Results{SearchResults: resultJson}, "", " ")
if err != nil {
return "", err
}

Loading…
Cancel
Save