max-id as flag for all timeline commands
This commit is contained in:
parent
3cf9966ec5
commit
c41ccc66bc
|
@ -308,7 +308,7 @@ func timelineLoop(endpoint string, flags timelineFlags) (tweets []Status) {
|
||||||
}
|
}
|
||||||
}()
|
}()
|
||||||
requestCount := 0
|
requestCount := 0
|
||||||
maxID := ""
|
maxID := flags.maxID
|
||||||
for len(tweets) < flags.count && requestCount < flags.maxRequests {
|
for len(tweets) < flags.count && requestCount < flags.maxRequests {
|
||||||
tmp := timeline(endpoint, maxID)
|
tmp := timeline(endpoint, maxID)
|
||||||
if len(tmp) == 0 {
|
if len(tmp) == 0 {
|
||||||
|
@ -328,11 +328,13 @@ func timelineLoop(endpoint string, flags timelineFlags) (tweets []Status) {
|
||||||
type timelineFlags struct {
|
type timelineFlags struct {
|
||||||
count int
|
count int
|
||||||
maxRequests int
|
maxRequests int
|
||||||
|
maxID string
|
||||||
}
|
}
|
||||||
|
|
||||||
func timelineFlagsVars(s *flag.FlagSet, f *timelineFlags) {
|
func timelineFlagsVars(s *flag.FlagSet, f *timelineFlags) {
|
||||||
s.IntVar(&f.count, "count", DEFAULT_COUNT, "try to get up to N tweets")
|
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.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 {
|
func mentions(flags timelineFlags, args []string) error {
|
||||||
|
|
Loading…
Reference in New Issue
Block a user