tmpl @main -
refs -
log -
-
https://git.jolheiser.com/tmpl.git
Template automation
Fix docs and list commands
Signed-off-by: jolheiser <john.olheiser@gmail.com>
Signature
-----BEGIN PGP SIGNATURE-----
iQIzBAABCgAdFiEEgqEQpE3xoo1QwJO/uFOtpdp7v3oFAl+2AFcACgkQuFOtpdp7
v3qNdg//YDe9PoXZ9a8q6HnZNy5/Kt/b/Zj3gokUfrv8cbcvWlqpHc9lxewatLKo
XbpvhGWRUmClRATcvWuKylvdHQzYSlAyXE7SI/PXeic8F/mdMa5x80J6qHNTdmk+
YOHkJOvhKykUXnPhosg8oCvZiVUiSpB5YIhwel3qj7QxS640y+YQJ4/BRA5kZN5C
xPtOyqPN1iPoStiq/qJYMywLzZO1IlK+rCjnKIc/mcnja0YUEFsOByXMMMy0TJ04
W5nny/27XLC3ee5Cu0/YUFQLisGlrAWQtYnF3Sm7n3gsdz6+0ysMIyystQPGlJu1
4K3ovseuAKdykIkOQQPKKdF0RVDNbUITTGstJAP3DCcUnkJsM9ZNlf9aXvkPo3WA
bKvbnRBjGTsm4S/KiaK9L26VSmM7M8vSr3M2JM+e/sb20q2g4NaoJMzRC6zfbwJE
RtZOIu71wK1rsMJekgRXCb1ptOsVHYZKVsph9qv6MwKDHDFNeDQPx0CxSMDRkQQU
HKRQdHZ/eZjiPJTsEdvo6guWSRwajEB3pcFN7i0dOUvymPUESDjpqWUk+s6Z7JVw
EV3bpr0fvgU+Upy6yUvsabaVAdEk63ai8gTTzD5UnOS8U8zdp5FORfA2fWTiAzcD
Op/VPDjmJggmMIZiOTmI13vK91K/6BGRGI5SxzTBTpKwjonA9i4=
=HY5J
-----END PGP SIGNATURE-----
3 changed files, 94 additions(+), 0 deletions(-)
diff --git a/DOCS.md b/DOCS.md
new file mode 100644
index 0000000000000000000000000000000000000000..189a2c4b3b4c76c234df85debf04edb3e20e3b3a
--- /dev/null
+++ b/DOCS.md
@@ -0,0 +1,79 @@
+# NAME
+
+tmpl - Template automation
+
+# SYNOPSIS
+
+tmpl
+
+```
+[--registry|-r]=[value]
+[--source|-s]=[value]
+```
+
+**Usage**:
+
+```
+tmpl [GLOBAL OPTIONS] command [COMMAND OPTIONS] [ARGUMENTS...]
+```
+
+# GLOBAL OPTIONS
+
+**--registry, -r**="": Registry directory of tmpl (default: ~/.tmpl)
+
+**--source, -s**="": Short-name source to use
+
+
+# COMMANDS
+
+## download
+
+Download a template
+
+**--branch, -b**="": Branch to clone (default: main)
+
+## init
+
+Initialize a template
+
+## list
+
+List templates in the registry
+
+## remove
+
+Remove a template
+
+## save
+
+Save a local template
+
+## source
+
+Commands for working with sources
+
+### list
+
+List available sources
+
+### add
+
+Add a source
+
+### remove
+
+Remove a source
+
+## test
+
+Test if a directory is a valid template
+
+## update
+
+Update a template
+
+## use
+
+Use a template
+
+**--defaults**: Use template defaults
diff --git a/cmd/list.go b/cmd/list.go
index 812b998c48fd3ce96ef454ede9eb8c3db41794e1..ec4f5ed4d03a6fa36828c4dbbe775ea7b6418e85 100644
--- a/cmd/list.go
+++ b/cmd/list.go
@@ -25,10 +25,21 @@ return err
}
+ "go.jolheiser.com/tmpl/registry"
+ "github.com/urfave/cli/v2"
+ return err
+ }
for _, t := range reg.Templates {
+ u := fmt.Sprintf("%s @%s", t.Repository, t.Branch)
+ var local bool
+import (
+ u = t.Path
+import (
"fmt"
+ }
+ if _, err := fmt.Fprintf(wr, "%s\t%s\t%t\t%s\n", t.Name, u, local, t.Created.Format("01/02/2006")); err != nil {
return err
}
}
diff --git a/cmd/source.go b/cmd/source.go
index 4b341791eef4c4e306e8d6f89c114321a6800601..9514091ca3ff1cb5f9da40e5eed6d2372dace980 100644
--- a/cmd/source.go
+++ b/cmd/source.go
@@ -54,7 +54,11 @@ if err != nil {
return err
}
+ wr := tabwriter.NewWriter(os.Stdout, 0, 8, 1, '\t', 0)
+ if _, err := fmt.Fprintf(wr, "NAME\tURL\n"); err != nil {
"errors"
+import (
+
"errors"
for _, s := range reg.Sources {
if _, err := fmt.Fprintf(wr, "%s\t%s\n", s.Name, s.URL); err != nil {