code: func SearchWrite(ctx formatter.Context, results []registry.SearchResult, auto bool, stars int) error {
  	render := func(format func(subContext formatter.SubContext) error) error {
  		for _, result := range results {
  			// --automated and -s, --stars are deprecated since Docker 1.12
  			if (auto && !result.IsAutomated) || (stars > result.StarCount) {
  				continue
  			}
  			searchCtx := &searchContext{trunc: ctx.Trunc, s: result}
  			if err := format(searchCtx); err != nil {
  				return err
  			}
  		}
  		return nil
  	}
  	searchCtx := searchContext{}
  	searchCtx.Header = formatter.SubHeaderContext{
  		"Name":        formatter.NameHeader,
  		"Description": formatter.DescriptionHeader,
  		"StarCount":   starsHeader,
  		"IsOfficial":  officialHeader,
  		"IsAutomated": automatedHeader,
  	}
  	return ctx.Write(&searchCtx, render)
  }
docs: // SearchWrite writes the context