mirror of
https://github.com/idanoo/autobrr
synced 2025-07-23 08:49:13 +00:00
feat(macros): add Tags (#1429)
This commit is contained in:
parent
eb43dadd2f
commit
2bf5993f05
2 changed files with 11 additions and 0 deletions
|
@ -48,6 +48,7 @@ type Macro struct {
|
||||||
CurrentHour int
|
CurrentHour int
|
||||||
CurrentMinute int
|
CurrentMinute int
|
||||||
CurrentSecond int
|
CurrentSecond int
|
||||||
|
Tags string
|
||||||
}
|
}
|
||||||
|
|
||||||
func NewMacro(release Release) Macro {
|
func NewMacro(release Release) Macro {
|
||||||
|
@ -86,6 +87,7 @@ func NewMacro(release Release) Macro {
|
||||||
CurrentHour: currentTime.Hour(),
|
CurrentHour: currentTime.Hour(),
|
||||||
CurrentMinute: currentTime.Minute(),
|
CurrentMinute: currentTime.Minute(),
|
||||||
CurrentSecond: currentTime.Second(),
|
CurrentSecond: currentTime.Second(),
|
||||||
|
Tags: strings.Join(release.Tags, ", "),
|
||||||
}
|
}
|
||||||
|
|
||||||
return ma
|
return ma
|
||||||
|
|
|
@ -245,6 +245,15 @@ func TestMacros_Parse(t *testing.T) {
|
||||||
want: "FilterID: 1",
|
want: "FilterID: 1",
|
||||||
wantErr: false,
|
wantErr: false,
|
||||||
},
|
},
|
||||||
|
{
|
||||||
|
name: "test_tags",
|
||||||
|
release: Release{
|
||||||
|
Tags: []string{"country", "rock"},
|
||||||
|
},
|
||||||
|
args: args{text: "Tags: {{ .Tags }}"},
|
||||||
|
want: "Tags: country, rock",
|
||||||
|
wantErr: false,
|
||||||
|
},
|
||||||
}
|
}
|
||||||
for _, tt := range tests {
|
for _, tt := range tests {
|
||||||
t.Run(tt.name, func(t *testing.T) {
|
t.Run(tt.name, func(t *testing.T) {
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue