26 lines
650 B
Go
26 lines
650 B
Go
package cli
|
|
|
|
import (
|
|
"fmt"
|
|
"gitea-mail-templates/tools/builder"
|
|
"github.com/urfave/cli/v2"
|
|
"path/filepath"
|
|
)
|
|
|
|
func ListCommand() *cli.Command {
|
|
return &cli.Command{Name: "list", Usage: "List available theme manifests", Flags: []cli.Flag{&cli.StringFlag{Name: "folder", Value: "../themes"}}, Action: func(c *cli.Context) error {
|
|
names, err := builder.Discover(c.String("folder"))
|
|
if err != nil {
|
|
return err
|
|
}
|
|
for _, name := range names {
|
|
t, err := builder.LoadTheme(filepath.Join(c.String("folder"), name))
|
|
if err != nil {
|
|
return err
|
|
}
|
|
fmt.Printf("%-16s %-8s %s\n", name, t.Mode, t.Description)
|
|
}
|
|
return nil
|
|
}}
|
|
}
|