Skip to content

Commit

Permalink
Add full_match and type back into response struct
Browse files Browse the repository at this point in the history
  • Loading branch information
FayeSGW committed Jan 16, 2025
1 parent fe9ba11 commit e20d28c
Showing 1 changed file with 10 additions and 1 deletion.
11 changes: 10 additions & 1 deletion cmd/kosli/search.go
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,8 @@ type SearchArtifact struct {
}

type ResolvedToBody struct {
Type string `json:"type"`
FullMatch string `json:"full_match"`
Fingerprints ResolvedFingerprints `json:"fingerprints"`
Commits ResolvedCommits `json:"commits"`
}
Expand Down Expand Up @@ -127,7 +129,14 @@ func printSearchAsTableWrapper(responseRaw string, out io.Writer, pageNumber int

countFingerprints := searchResult.ResolvedTo.Fingerprints.Count
countCommits := searchResult.ResolvedTo.Commits.Count
logger.Info("Search result resolved to %d fingerprint(s) and %d commit(s) across %d artifacts\n", countFingerprints, countCommits, len(searchResult.Artifacts))
fullMatch := searchResult.ResolvedTo.FullMatch
if searchResult.ResolvedTo.Type == "commit" {
logger.Info("Search result resolved to commit %s", fullMatch)
} else if searchResult.ResolvedTo.Type == "fingerprint" {
logger.Info("Search result resolved to artifact with fingerprint %s", fullMatch)
} else {
logger.Info("Search result resolved to %d fingerprint(s) and %d commit(s) across %d artifacts\n", countFingerprints, countCommits, len(searchResult.Artifacts))
}

rows := []string{}
for _, artifact := range searchResult.Artifacts {
Expand Down

0 comments on commit e20d28c

Please sign in to comment.