You are an expert in writing code in many different languages. Your goal is to perform code completion for the following code, keeping in mind the rest of the code and the file meta data.
    Metadata details:
    filename: opts_help.go
    path of file: ./repos/cloud-torrent/vendor/github.com/jpillora/opts
    
    the code of the file until where you have to start completion: package opts

import (
	"bytes"
	"fmt"
	"log"
	"path"
	"regexp"
	"strings"
	"text/template"

	"github.com/kardianos/osext"
)

//data is only used for templating below
type data struct {
	datum        //data is also a datum
	ArgList      *datum
	Opts         []*datum
	Args         []*datum
	Cmds         []*datum
	Order        []string
	Version      string
	Repo, Author string
	ErrMsg       string
}

type datum struct {
	Name, Help, Pad string //Pad is Opt.PadWidth many spaces
}

type text struct {
	Text, Def, Env string
}

var DefaultOrder = []string{
	"usage",
	"args",
	"arglist",
	"options",
	"cmds",
	"author",
	"version",
	"repo",
	"errmsg",
}

var DefaultTemplates = map[string]string{
	//the root template simply loops through
	//the 'order' and renders each template by name
	"help": `{{ $root := . }}` +
		`{{range $t := .Order}}{{ templ $t $root }}{{end}}`,
	//sections, from top to bottom
	"usage": `Usage: {{.Name 
    
func (o *Opts) Help() string {
	var err error

	//final attempt at finding the program name
	root := o
	for root.parent != nil {
		root = root.parent
	}
	if root.name == "" {
		if exe, err := osext.Executable(); err == nil {
			_, root.name = path.Split(exe)
		} else {
			root.name = "main"
		}
	}

	//add default templates
	for name, str := range DefaultTemplates {
		if _, ok := o.templates[name]; !ok {
			o.templates[name] = str
		}
	}

	//prepare templates
	t := template.New(o.name)

	t = t.Funcs(map[string]interface{}{
		//reimplementation of "template" except with dynamic name
		"templ": func(name string, data interface{}) (string, error) {
			b := &bytes.Buffer{}
			err = t.ExecuteTemplate(b, name, data)
			if err != nil {
				return "", err
			}
			return b.String(), nil
		},
	})

	//verify all templates
	for name, str := range o.templates {
		t, err = t.Parse(fmt.Sprintf(`{{define "%s"}}%s{{end}}`, name, str))
		if err != nil {
			log.Fatalf("Template error: %s: %s", name, err)
		}
	}

	//convert Opts into template data
	tf := convert(o)

	//execute all templates
	b := &bytes.Buffer{}
	err = t.ExecuteTemplate(b, "help", tf)
	if err != nil {
		log.Fatalf("Template execute: %s", err)
	}

	out := b.String()

	if o.PadAll {
		/*
			"foo
			bar"
			becomes
			"
			  foo
			  bar
			"
		*/
		lines := strings.Split(out, "\n")
		for i, l := range lines {
			lines[i] = tf.Pad + l
		}
		out = "\n" + strings.Join(lines, "\n")
	}

	out = trailingSpaces.ReplaceAllString(out, "")

	return out
}