From c41ccc66bc08b689a345d2123a1d1966cc963755 Mon Sep 17 00:00:00 2001 From: gutmet Date: Wed, 21 Oct 2020 12:34:14 +0200 Subject: [PATCH] max-id as flag for all timeline commands --- drivel.go | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/drivel.go b/drivel.go index 30e486a..ed6aeb9 100644 --- a/drivel.go +++ b/drivel.go @@ -308,7 +308,7 @@ func timelineLoop(endpoint string, flags timelineFlags) (tweets []Status) { } }() requestCount := 0 - maxID := "" + maxID := flags.maxID for len(tweets) < flags.count && requestCount < flags.maxRequests { tmp := timeline(endpoint, maxID) if len(tmp) == 0 { @@ -328,11 +328,13 @@ func timelineLoop(endpoint string, flags timelineFlags) (tweets []Status) { type timelineFlags struct { count int maxRequests int + maxID string } func timelineFlagsVars(s *flag.FlagSet, f *timelineFlags) { s.IntVar(&f.count, "count", DEFAULT_COUNT, "try to get up to N tweets") s.IntVar(&f.maxRequests, "max-requests", MAX_TIMELINE_REQUESTS, "try to achieve count with a maximum of N requests") + s.StringVar(&f.maxID, "max-id", "", "only get tweets with an ID lower or equal to max-id") } func mentions(flags timelineFlags, args []string) error {