chore: migrate mail themes to shared framework and locked upstream inputs
This commit is contained in:
1 parent
5c0589f6f6
commit
fec3ace600
225 files changed
+4718
-15807
No files matched your search
@@ -0,0 +1,31 @@
|
||||
package cli
|
||||
|
||||
import (
|
||||
"fmt"
|
||||
"gitea-mail-templates/tools/upstream"
|
||||
"github.com/urfave/cli/v2"
|
||||
)
|
||||
|
||||
func UpstreamCommand() *cli.Command {
|
||||
return &cli.Command{Name: "upstream", Usage: "Prepare, synchronize or verify locked official build inputs", Subcommands: []*cli.Command{
|
||||
{Name: "prepare", Usage: "Download missing immutable cache files from gitea.lock.json", Flags: []cli.Flag{&cli.StringFlag{Name: "root", Value: ".."}}, Action: func(c *cli.Context) error { _, err := upstream.Prepare(c.Context, c.String("root")); return err }},
|
||||
{Name: "sync", Usage: "Review a new Gitea tag and regenerate the lock and cache", Flags: []cli.Flag{&cli.StringFlag{Name: "tag", Required: true}, &cli.StringFlag{Name: "root", Value: ".."}}, Action: func(c *cli.Context) error { return upstream.SyncRoot(c.Context, c.String("tag"), c.String("root")) }},
|
||||
{Name: "verify", Usage: "Verify cached inputs against the repository lock offline", Flags: []cli.Flag{&cli.StringFlag{Name: "root", Value: ".."}}, Action: func(c *cli.Context) error {
|
||||
s, err := upstream.LoadPinned(c.String("root"))
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
missing, err := upstream.MissingKeys(s)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
fmt.Printf("[PASS] %s: %d mail files, %d languages\n", s.Lock.Tag, len(s.Templates), len(s.Locales))
|
||||
for _, lang := range s.Languages() {
|
||||
if keys := missing[lang]; len(keys) > 0 {
|
||||
fmt.Printf("[FALLBACK] %s -> en-US: %v\n", lang, keys)
|
||||
}
|
||||
}
|
||||
return nil
|
||||
}},
|
||||
}}
|
||||
}
|
||||
Reference in new issue
Block a user