diff --git a/DOCS.md b/DOCS.md new file mode 100644 index 0000000..189a2c4 --- /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 812b998..ec4f5ed 100644 --- a/cmd/list.go +++ b/cmd/list.go @@ -24,9 +24,18 @@ func runList(_ *cli.Context) error { return err } - wr := tabwriter.NewWriter(os.Stdout, 0, 8, 0, '\t', 0) + wr := tabwriter.NewWriter(os.Stdout, 0, 8, 1, '\t', 0) + if _, err := fmt.Fprintf(wr, "NAME\tURL\tLOCAL\tUPDATED\n"); err != nil { + return err + } for _, t := range reg.Templates { - if _, err := fmt.Fprintf(wr, "%s\t%s@%s\t%s\n", t.Name, t.Repository, t.Branch, t.Created); err != nil { + u := fmt.Sprintf("%s @%s", t.Repository, t.Branch) + var local bool + if t.Path != "" { + u = t.Path + local = true + } + 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 4b34179..9514091 100644 --- a/cmd/source.go +++ b/cmd/source.go @@ -54,7 +54,10 @@ func runSourceList(_ *cli.Context) error { return err } - wr := tabwriter.NewWriter(os.Stdout, 0, 8, 0, '\t', 0) + wr := tabwriter.NewWriter(os.Stdout, 0, 8, 1, '\t', 0) + if _, err := fmt.Fprintf(wr, "NAME\tURL\n"); err != nil { + return err + } for _, s := range reg.Sources { if _, err := fmt.Fprintf(wr, "%s\t%s\n", s.Name, s.URL); err != nil { return err