code: func (f *JSONPathPrintFlags) ToPrinter(templateFormat string) (printers.ResourcePrinter, error) {
  	if (f.TemplateArgument == nil || len(*f.TemplateArgument) == 0) && len(templateFormat) == 0 {
  		return nil, NoCompatiblePrinterError{Options: f, OutputFormat: &templateFormat}
  	}
  
  	templateValue := ""
  
  	if f.TemplateArgument == nil || len(*f.TemplateArgument) == 0 {
  		for format := range jsonFormats {
  			format = format + "="
  			if strings.HasPrefix(templateFormat, format) {
  				templateValue = templateFormat[len(format):]
  				templateFormat = format[:len(format)-1]
  				break
  			}
  		}
  	} else {
  		templateValue = *f.TemplateArgument
  	}
  
  	if _, supportedFormat := jsonFormats[templateFormat]; !supportedFormat {
  		return nil, NoCompatiblePrinterError{OutputFormat: &templateFormat, AllowedFormats: f.AllowedFormats()}
  	}
  
  	if len(templateValue) == 0 {
  		return nil, fmt.Errorf("template format specified but no template given")
  	}
  
  	if templateFormat == "jsonpath-file" {
  		data, err := ioutil.ReadFile(templateValue)
  		if err != nil {
  			return nil, fmt.Errorf("error reading --template %s, %v\n", templateValue, err)
  		}
  
  		templateValue = string(data)
  	}
  
  	p, err := printers.NewJSONPathPrinter(templateValue)
  	if err != nil {
  		return nil, fmt.Errorf("error parsing jsonpath %s, %v\n", templateValue, err)
  	}
  
  	allowMissingKeys := true
  	if f.AllowMissingKeys != nil {
  		allowMissingKeys = *f.AllowMissingKeys
  	}
  
  	p.AllowMissingKeys(allowMissingKeys)
  	return p, nil
  }
docs: // ToPrinter receives an templateFormat and returns a printer capable of
  // handling --template format printing.
  // Returns false if the specified templateFormat does not match a template format.