MCPcopy Create free account
hub / github.com/VirusTotal/vt-cli / PrintIterator

Method PrintIterator

utils/printer.go:225–251  ·  view source on GitHub ↗

PrintIterator prints the objects returned by an object iterator.

(it *vt.Iterator)

Source from the content-addressed store, hash-verified

223
224// PrintIterator prints the objects returned by an object iterator.
225func (p *Printer) PrintIterator(it *vt.Iterator) error {
226 var objs []*vt.Object
227 var ids []string
228 for it.Next() {
229 obj := it.Get()
230 if viper.GetBool("identifiers-only") {
231 ids = append(ids, obj.ID())
232 } else {
233 objs = append(objs, obj)
234 }
235 }
236 if err := it.Error(); err != nil {
237 return err
238 }
239
240 if viper.GetBool("identifiers-only") {
241 if err := p.Print(ids); err != nil {
242 return err
243 }
244 } else {
245 if err := p.PrintObjects(objs); err != nil {
246 return err
247 }
248 }
249 p.PrintCommandLineWithCursor(it)
250 return nil
251}
252
253// PrintCommandLineWithCursor prints the same command-line that was used for
254// executing the program but adding or replacing the --cursor flag with

Callers 2

PrintCollectionMethod · 0.95
runSearchCmdFunction · 0.95

Calls 3

PrintMethod · 0.95
PrintObjectsMethod · 0.95

Tested by

no test coverage detected