[tint] Shuffle template generation code

Add helpers for loading templates from files. Include the file path in
the template - helpers with errors.

Move the intrinsic generation code out to a sub-package.
Use the subcmd package to allow for more future commands.

Change-Id: I909b654a2930f749b2a67ae29c3d1e90296c0523
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/146382
Reviewed-by: James Price <jrprice@google.com>
Commit-Queue: Ben Clayton <bclayton@google.com>
Kokoro: Kokoro <noreply+kokoro@google.com>
diff --git a/tools/src/template/template_test.go b/tools/src/template/template_test.go
index f18e727..d4f94c4 100644
--- a/tools/src/template/template_test.go
+++ b/tools/src/template/template_test.go
@@ -22,12 +22,11 @@
 	"github.com/google/go-cmp/cmp"
 )
 
-func check(t *testing.T, tmpl, expected string, fns template.Functions) {
+func check(t *testing.T, content, expected string, fns template.Functions) {
 	t.Helper()
 	w := &bytes.Buffer{}
-	err := template.Run(tmpl, w, fns)
-	if err != nil {
-		t.Errorf("template.Run() failed with %v", err)
+	if err := template.FromString("template", content).Run(w, nil, fns); err != nil {
+		t.Errorf("Template.Run() failed with %v", err)
 		return
 	}
 	got := w.String()