-
Notifications
You must be signed in to change notification settings - Fork 4
/
Copy pathsvg.go
39 lines (29 loc) · 852 Bytes
/
svg.go
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
package action
import (
"context"
"fmt"
"projectforge.dev/projectforge/app/project/svg"
)
const refreshMode = "refresh"
func onSVG(ctx context.Context, pm *PrjAndMods) *Result {
ret := newResult(TypeSVG, pm.Prj, pm.Cfg, pm.Logger)
tgt := fmt.Sprintf("%s/app/util/svg.go", pm.Prj.Path)
fs, err := pm.PSvc.GetFilesystem(pm.Prj)
if err != nil {
return ret.WithError(err)
}
if pm.Cfg.GetStringOpt("mode") == refreshMode {
ret.AddLog("refreshing app SVG for project [%s]", pm.Prj.Key)
err = svg.RefreshAppIcon(ctx, pm.Prj, fs, pm.Logger)
if err != nil {
return errorResult(err, TypeSVG, pm.Cfg, pm.Logger)
}
return ret
}
count, err := svg.Run(fs, tgt, pm.Logger)
if err != nil {
return errorResult(err, TypeSVG, pm.Cfg, pm.Logger)
}
ret.AddLog("creating [%d] SVGs for project [%s]", count, pm.Prj.Key)
return ret
}