~skuzzymiglet/feef

fc0ef838de02d0e60958d3f504051caba4be1f7d — skuzzymiglet 1 year, 7 days ago 4d0b3e6 http-err
initial -E scaffold
2 files changed, 10 insertions(+), 1 deletions(-)

M fetcher.go
M main.go
M fetcher.go => fetcher.go +9 -0
@@ 13,6 13,15 @@ import (
	"github.com/gosimple/slug"
)

type HTTPStatusCodeError struct {
	req  http.Request
	resp http.Response
}

func (h *HTTPStatusCodeError) Error() string {
	return fmt.Sprintf("Error fetching %s: status code %d", h.req.URL.String(), h.resp.StatusCode)
}

type Fetcher struct {
	client    *http.Client
	sema      chan struct{}

M main.go => main.go +1 -1
@@ 80,7 80,7 @@ func main() {
	flag.IntVarP(&max, "max", "m", 0, "maximum items to output, 0 for no limit")
	flag.DurationVarP(&timeout, "timeout", "t", time.Second*5, "feed-fetching timeout")
	flag.BoolVarP(&exitOnFailedCommand, "exit-on-failed-command", "e", false, "exit if a command (-c) fails")
	flag.BoolVarP(&exitOnFailedFetch, "exit-on-failed-fetch", "E", false, "exit if fetching a feed fails")
	flag.BoolVarP(&exitOnFailedFetch, "exit-on-failed-fetch", "E", false, "exit if fetching a feed fails (4xx or 5xx response code)")
	flag.IntVarP(&threads, "download-threads", "p", runtime.GOMAXPROCS(0), "maximum number of concurrent downloads") // NOTE: I'm not sure GOMAXPROCS is a reasonable default for this. Maybe we should set it to 1 for safety but that's slow
	flag.BoolVarP(&sort, "sort", "s", false, "sort feed items chronologically")
	flag.StringVarP(&notifyMode, "notify-mode", "n", "none", "notification mode (none, new or all)")