~chrisppy/beagles

cfbce5741f55ed9c17ba8182332ccc5bfa34a9b1 — Chris Palmer a month ago f5ad6a8
Add bare needed for backup/restore
5 files changed, 119 insertions(+), 7 deletions(-)

M Makefile
A fmsg/gen.go
A fmsg/schema.bare
M go.mod
M go.sum
M Makefile => Makefile +7 -1
@@ 44,6 44,12 @@ clean:
	$(RM) $(DOCS) $(PKGNAME) *.tar.gz
	$(RM) -r vendor

gen:
	$(GO) get -u git.sr.ht/~sircmpwn/getopt
	$(GO) get -u git.sr.ht/~sircmpwn/go-bare
	$(GO) run git.sr.ht/~sircmpwn/go-bare/cmd/gen -p fmsg fmsg/schema.bare \
		fmsg/gen.go

install: all
	mkdir -m755 -p $(BINDIR) $(MANDIR)/man1 $(MANDIR)/man5
	install -m755 $(PKGNAME) $(BINDIR)/$(PKGNAME)


@@ 101,4 107,4 @@ package: check

.DEFAULT_GOAL := all

.PHONY: all doc clean install uninstall check package
.PHONY: all doc clean install uninstall check package gen

A fmsg/gen.go => fmsg/gen.go +77 -0
@@ 0,0 1,77 @@
package fmsg

// Code generated by go-bare/cmd/gen, DO NOT EDIT.

import (
	"git.sr.ht/~sircmpwn/go-bare"
)

type Time string

func (t *Time) Decode(data []byte) error {
	return bare.Unmarshal(data, t)
}

func (t *Time) Encode() ([]byte, error) {
	return bare.Marshal(t)
}

type Message MessageV1

func (t *Message) Decode(data []byte) error {
	return bare.Unmarshal(data, t)
}

func (t *Message) Encode() ([]byte, error) {
	return bare.Marshal(t)
}

type MessageV1 struct {
	Created   Time   `bare:"created"`
	Generator string `bare:"generator"`
	Feeds     []Feed `bare:"feeds"`
}

func (t *MessageV1) Decode(data []byte) error {
	return bare.Unmarshal(data, t)
}

func (t *MessageV1) Encode() ([]byte, error) {
	return bare.Marshal(t)
}

type Feed struct {
	Feed        string `bare:"feed"`
	Title       string `bare:"title"`
	Description string `bare:"description"`
	Link        string `bare:"link"`
	Items       []Item `bare:"items"`
}

func (t *Feed) Decode(data []byte) error {
	return bare.Unmarshal(data, t)
}

func (t *Feed) Encode() ([]byte, error) {
	return bare.Marshal(t)
}

type Item struct {
	Link     string `bare:"link"`
	Title    string `bare:"title"`
	Content  string `bare:"content"`
	Location string `bare:"location"`
	Mimetype string `bare:"mimetype"`
	Length   string `bare:"length"`
	Read     bool   `bare:"read"`
	Favorite bool   `bare:"favorite"`
	Date     Time   `bare:"date"`
}

func (t *Item) Decode(data []byte) error {
	return bare.Unmarshal(data, t)
}

func (t *Item) Encode() ([]byte, error) {
	return bare.Marshal(t)
}

A fmsg/schema.bare => fmsg/schema.bare +28 -0
@@ 0,0 1,28 @@
type Time string # ISO 8601
type Message MessageV1

type MessageV1 {
	created: Time
	generator: string
	feeds: []Feed
}

type Feed {
	feed: string
	title: string
	description: string
	link: string
	items: []Item
}

type Item {
	link: string
	title: string
	content: string
	location: string
	mimetype: string
	length: string
	read: bool
	favorite: bool
	date: Time
}

M go.mod => go.mod +1 -2
@@ 4,6 4,7 @@ go 1.14

require (
	git.sr.ht/~sircmpwn/getopt v0.0.0-20191230200459-23622cc906b3
	git.sr.ht/~sircmpwn/go-bare v0.0.0-20201009180350-cb0704728ca1
	github.com/DataDrake/waterlog v1.0.5
	github.com/gdamore/tcell/v2 v2.0.0
	github.com/jaytaylor/html2text v0.0.0-20200412013138-3577fbdbcff7


@@ 12,11 13,9 @@ require (
	github.com/olekukonko/tablewriter v0.0.4 // indirect
	github.com/pelletier/go-toml v1.8.1
	github.com/ssor/bom v0.0.0-20170718123548-6386211fdfcf // indirect
	github.com/stretchr/testify v1.4.0 // indirect
	gitlab.com/tslocum/cbind v0.1.3
	gitlab.com/tslocum/cview v1.5.1-0.20201009235145-c33ce9563344
	go.etcd.io/bbolt v1.3.5
	golang.org/x/net v0.0.0-20201021035429-f5854403a974 // indirect
	gopkg.in/check.v1 v1.0.0-20190902080502-41f04d3bba15 // indirect
	gopkg.in/yaml.v2 v2.3.0 // indirect
)

M go.sum => go.sum +6 -4
@@ 1,5 1,7 @@
git.sr.ht/~sircmpwn/getopt v0.0.0-20191230200459-23622cc906b3 h1:4wDp4BKF7NQqoh73VXpZsB/t1OEhDpz/zEpmdQfbjDk=
git.sr.ht/~sircmpwn/getopt v0.0.0-20191230200459-23622cc906b3/go.mod h1:wMEGFFFNuPos7vHmWXfszqImLppbc0wEhh6JBfJIUgw=
git.sr.ht/~sircmpwn/go-bare v0.0.0-20201009180350-cb0704728ca1 h1:UQ3n+JCY5i1QX0GOiPz+fV3IvqTf93hJdVqCdcp02lM=
git.sr.ht/~sircmpwn/go-bare v0.0.0-20201009180350-cb0704728ca1/go.mod h1:BVJwbDfVjCjoFiKrhkei6NdGcZYpkDkdyCdg1ukytRA=
github.com/BurntSushi/toml v0.3.1 h1:WXkYYl6Yr3qBf1K79EBnL4mak0OimBfB0XUf9Vl28OQ=
github.com/BurntSushi/toml v0.3.1/go.mod h1:xHWCNGjB5oqiDr8zfno3MHue2Ht5sIBksp03qcyfWMU=
github.com/DataDrake/waterlog v1.0.5 h1:+c506dboTQh4MoHHwdVtNa9E8K/3qAM/lieke0mH/mE=


@@ 58,8 60,8 @@ github.com/ssor/bom v0.0.0-20170718123548-6386211fdfcf h1:pvbZ0lM0XWPBqUKqFU8cma
github.com/ssor/bom v0.0.0-20170718123548-6386211fdfcf/go.mod h1:RJID2RhlZKId02nZ62WenDCkgHFerpIOmW0iT7GKmXM=
github.com/stretchr/objx v0.1.0/go.mod h1:HFkY916IF+rwdDfMAkV7OtwuqBVzrE8GR6GFx+wExME=
github.com/stretchr/testify v1.3.0/go.mod h1:M5WIy9Dh21IEIfnGCwXGc5bZfKNJtfHm1UVUgZn+9EI=
github.com/stretchr/testify v1.4.0 h1:2E4SXV/wtOkTonXsotYi4li6zVWxYlZuYNCXe9XRJyk=
github.com/stretchr/testify v1.4.0/go.mod h1:j7eGeouHqKxXV5pUuKE4zz7dFj8WfuZ+81PSLYec5m4=
github.com/stretchr/testify v1.6.1 h1:hDPOHmpOpP40lSULcqw7IrRb/u7w6RpDC9399XyoNd0=
github.com/stretchr/testify v1.6.1/go.mod h1:6Fq8oRcR53rry900zMqJjRRixrwX3KX962/h/Wwjteg=
github.com/urfave/cli v1.22.3/go.mod h1:Gos4lmkARVdJ6EkW0WaNv/tZAAMe9V7XWyB60NtXRu0=
gitlab.com/tslocum/cbind v0.1.2 h1:ptDjO7WeOl1HglprsK18L8I9JeRkmtuBoBBaYw/6/Ow=
gitlab.com/tslocum/cbind v0.1.2/go.mod h1:HfB7qAhHSZbn1rFK8M9SvSN5NG6ScAg/3h3iE6xdeeI=


@@ 103,5 105,5 @@ gopkg.in/check.v1 v1.0.0-20190902080502-41f04d3bba15 h1:YR8cESwS4TdDjEe65xsg0ogR
gopkg.in/check.v1 v1.0.0-20190902080502-41f04d3bba15/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0=
gopkg.in/yaml.v2 v2.2.2 h1:ZCJp+EgiOT7lHqUV2J862kp8Qj64Jo6az82+3Td9dZw=
gopkg.in/yaml.v2 v2.2.2/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI=
gopkg.in/yaml.v2 v2.3.0 h1:clyUAQHOM3G0M3f5vQj7LuJrETvjVot3Z5el9nffUtU=
gopkg.in/yaml.v2 v2.3.0/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI=
gopkg.in/yaml.v3 v3.0.0-20200313102051-9f266ea9e77c h1:dUUwHk2QECo/6vqA44rthZ8ie2QXMNeKRTHCNY2nXvo=
gopkg.in/yaml.v3 v3.0.0-20200313102051-9f266ea9e77c/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM=