Skip to content

Commit

Permalink
In content searches print whether the match was in a subfile or not.
Browse files Browse the repository at this point in the history
  • Loading branch information
plusvic committed Aug 2, 2018
1 parent 2cdae17 commit e56217d
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions cmd/search.go
Original file line number Diff line number Diff line change
Expand Up @@ -134,6 +134,7 @@ func (m *matchPrinter) Do(fileObj interface{}, ds *utils.DoerState) string {
var s string
confidence := f.ContextAttributes["confidence"].(float64)
snippetID := f.ContextAttributes["snippet"].(string)
inSubFile := f.ContextAttributes["match_in_subfile"].(bool)
snippets := make([]string, 0)
_, err := m.client.GetData(vt.URL("intelligence/search/snippets/%s", snippetID), &snippets)
if err == nil {
Expand All @@ -144,8 +145,8 @@ func (m *matchPrinter) Do(fileObj interface{}, ds *utils.DoerState) string {
s = "<no snippet available>"
}
line = fmt.Sprintf(
"%s\n\nsha256 : %s\nscore : %03.1f \n\n%s\n",
strings.Repeat("_", 76), f.ID, confidence, s)
"%s\n\nsha256 : %s\nscore : %03.1f \nsubfile : %v\n\n%s\n",
strings.Repeat("_", 76), f.ID, confidence, inSubFile, s)
}
return line
}
Expand Down

0 comments on commit e56217d

Please sign in to comment.