max-id as flag for all timeline commands

This commit is contained in:
gutmet 2020-10-21 12:34:14 +02:00
parent 3cf9966ec5
commit c41ccc66bc

View File

@ -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 {