Simple RSS/Atom feed source for diretto
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

46 lines
908 B

package main
import (
"context"
"flag"
"fmt"
"os"
"strings"
proto "git.abbiamoundominio.org/hamcha/bacheca/proto"
"github.com/go-kit/kit/log"
svc "git.abbiamoundominio.org/hamcha/bacheca"
)
func main() {
format := flag.String("fmt", "rss", "Feed format (rss, atom, json)")
flag.Parse()
ftype := strings.ToUpper(*format)
fid, ok := proto.GetFeedRequest_FeedType_value[ftype]
if !ok {
panic("invalid format (-fmt), check help for supported formats")
}
var logger log.Logger
{
logger = log.NewLogfmtLogger(os.Stderr)
logger = log.With(logger, "ts", log.DefaultTimestampUTC)
logger = log.With(logger, "caller", log.DefaultCaller)
}
s := svc.MakeService()
req := &proto.GetFeedRequest{
FeedType: proto.GetFeedRequest_FeedType(fid),
}
rsp := &proto.GetFeedResponse{}
err := s.GetFeed(context.Background(), req, rsp)
if err != nil {
panic(err)
}
fmt.Print(rsp.Data)
}