chore: various cosmetic changes.
This commit is contained in:
parent
256d4abde8
commit
aea0034fcc
16 changed files with 35 additions and 32 deletions
|
|
@ -19,7 +19,7 @@ var Builds = []BuildFunc{
|
|||
|
||||
var (
|
||||
regAttachments = regexp.MustCompile(`(profile .* @{exec_path})`)
|
||||
regFlag = regexp.MustCompile(`flags=\(([^)]+)\)`)
|
||||
regFlagComplain = regexp.MustCompile(`flags=\(([^)]+)\)`)
|
||||
regProfileHeader = regexp.MustCompile(` {`)
|
||||
)
|
||||
|
||||
|
|
@ -28,7 +28,7 @@ type BuildFunc func(string) string
|
|||
// Set complain flag on all profiles
|
||||
func BuildComplain(profile string) string {
|
||||
flags := []string{}
|
||||
matches := regFlag.FindStringSubmatch(profile)
|
||||
matches := regFlagComplain.FindStringSubmatch(profile)
|
||||
if len(matches) != 0 {
|
||||
flags = strings.Split(matches[1], ",")
|
||||
if slices.Contains(flags, "complain") {
|
||||
|
|
@ -39,7 +39,7 @@ func BuildComplain(profile string) string {
|
|||
strFlags := " flags=(" + strings.Join(flags, ",") + ") {"
|
||||
|
||||
// Remove all flags definition, then set manifest' flags
|
||||
profile = regFlag.ReplaceAllLiteralString(profile, "")
|
||||
profile = regFlagComplain.ReplaceAllLiteralString(profile, "")
|
||||
return regProfileHeader.ReplaceAllLiteralString(profile, strFlags)
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -161,7 +161,7 @@ func SetFlags() error {
|
|||
}
|
||||
|
||||
// Remove all flags definition, then set manifest' flags
|
||||
res := regFlag.ReplaceAllLiteralString(string(content), "")
|
||||
res := regFlagComplain.ReplaceAllLiteralString(string(content), "")
|
||||
res = regProfileHeader.ReplaceAllLiteralString(res, flags)
|
||||
if err := file.WriteFile([]byte(res)); err != nil {
|
||||
return err
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue