docs: def export(outfile):
      """Export image anchore data to a JSON file."""
  
      if not nav:
          sys.exit(1)
  
      ecode = 0
      savelist = list()
      for imageId in imagelist:
  
          try:
              record = {}
              record['image'] = {}
              record['image']['imageId'] = imageId
              record['image']['imagedata'] = contexts['anchore_db'].load_image_new(imageId)
          
              savelist.append(record)
          except Exception as err:
              anchore_print_err("could not find record for image ("+str(imageId)+")")
              ecode = 1
  
      if ecode == 0:
          try:
              if outfile == '-':
                  print json.dumps(savelist, indent=4)
              else:
                  with open(outfile, 'w') as OFH:
                      OFH.write(json.dumps(savelist))
          except Exception as err:
              anchore_print_err("operation failed: " + str(err))
              ecode = 1
  
      sys.exit(ecode)