1
0
mirror of https://github.com/go-task/task.git synced 2025-11-23 22:24:45 +02:00

feat: XDG taskrc config (#2380)

Co-authored-by: Valentin Maerten <maerten.valentin@gmail.com>
This commit is contained in:
Pete Davison
2025-08-18 21:43:36 +01:00
committed by GitHub
parent c903d07332
commit f89c12ddf0
14 changed files with 564 additions and 109 deletions

View File

@@ -1,8 +1,27 @@
package ast
import "github.com/Masterminds/semver/v3"
import (
"maps"
"github.com/Masterminds/semver/v3"
)
type TaskRC struct {
Version *semver.Version `yaml:"version"`
Experiments map[string]int `yaml:"experiments"`
}
// Merge combines the current TaskRC with another TaskRC, prioritizing non-nil fields from the other TaskRC.
func (t *TaskRC) Merge(other *TaskRC) {
if other == nil {
return
}
if t.Version == nil && other.Version != nil {
t.Version = other.Version
}
if t.Experiments == nil && other.Experiments != nil {
t.Experiments = other.Experiments
} else if t.Experiments != nil && other.Experiments != nil {
maps.Copy(t.Experiments, other.Experiments)
}
}