Fix docs and list commands
Signed-off-by: jolheiser <john.olheiser@gmail.com>pull/7/head v0.0.4
parent
1c516ad3db
commit
ff2f159802
|
@ -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
|
13
cmd/list.go
13
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
|
||||
}
|
||||
}
|
||||
|
|
|
@ -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
|
||||
|
|
Loading…
Reference in New Issue