1
0

more tests for good boy points, split entities into files

This commit is contained in:
2021-03-04 17:30:38 +01:00
parent f2347b8801
commit 13a990bb4a
6 changed files with 83 additions and 53 deletions

27
feed.go Normal file
View File

@ -0,0 +1,27 @@
package main
import (
"fmt"
"strings"
)
type Feed struct {
URL string
Description string
Tags []string
}
// Return the final feed string, depending on either the link has a description, tags or not
func (f Feed) String() string {
var ff string
var tags string = strings.TrimSpace(strings.Join(f.Tags, " "))
ff = fmt.Sprintf("%s %s", f.URL, tags)
if f.Description != "" {
ff = fmt.Sprintf("%s # %s", strings.TrimSpace(ff), f.Description)
}
return strings.TrimSpace(ff)
}