chromedp/cmd/chromedp-gen/templates/file.qtpl
Kenneth Shaw db4400bfe9 Dropping custom qtc + easyjson
- Updating documentation for chromedp-gen to point to standard versions
  of easyjson/quicktemplate (qtc) and added information about goimports
- Replaced {% end %} non-standard quicktemplate tags with the
  appropriate closing tags
- Updated to latest chrome protocol.json definition
- Regenerated cdp protocol after switching to standard easyjson/qtc
2017-02-18 11:02:24 +07:00

40 lines
1.1 KiB
Plaintext

{% import (
"sort"
"github.com/knq/chromedp/cmd/chromedp-gen/internal"
) %}
// FileHeader is the file header template.
{% func FileHeader(pkgName string, d *internal.Domain) %}
{% if d != nil %}// Package {%s= d.PackageName() %} provides the Chrome Debugging Protocol
// commands, types, and events for the {%s= d.String() %} domain.
// {% if desc := d.Description; desc != "" %}
{%s= formatComment(desc, "", "") %}
//{% endif %}
// Generated by the chromedp-gen command.{% endif %}
package {%s= pkgName %}
// AUTOGENERATED. DO NOT EDIT.
{% endfunc %}
// FileImportTemplate is a general import template.
{% func FileImportTemplate(m map[string]string) %}{% code
var keys []string
for k, _ := range m {
keys = append(keys, k)
}
sort.Strings(keys)
%}
import ({% for _, k := range keys %}{% code
v := m[k]
%}
{% if k != v %}{%s= v %} {% endif %}"{%s= k %}"{% endfor %}
)
{% endfunc %}
// FileVarTemplate is a template for a single variable declaration.
{% func FileVarTemplate(name, value, desc string) %}
{%s= formatComment(desc, "", name+" ") %}
var {%s= name %} = {%s= value %}
{% endfunc %}