cmd/timelines.go
changeset 22 5778b09bc6fe
parent 20 b0ccc09f07a2
child 44 6da40ca4534c
--- a/cmd/timelines.go	Fri Apr 28 15:53:09 2017 +0200
+++ b/cmd/timelines.go	Fri Apr 28 16:56:33 2017 +0200
@@ -12,8 +12,8 @@
 )
 
 var timelineOpts struct {
-	local bool
-	limit uint
+	local                 bool
+	limit, sinceID, maxID uint
 }
 
 // timelineCmd represents the timelines command
@@ -37,16 +37,27 @@
 
 	timelineCmd.Flags().BoolVar(&timelineOpts.local, "local", false, "Posts from the local instance")
 	timelineCmd.Flags().UintVarP(&timelineOpts.limit, "limit", "l", 0, "Limit number of results")
+	timelineCmd.PersistentFlags().UintVar(&timelineOpts.sinceID, "since-id", 0, "Request IDs greater than a value")
+	timelineCmd.PersistentFlags().UintVar(&timelineOpts.maxID, "max-id", 0, "Request IDs less (or equal) than a value")
 }
 
 func timelineRunE(cmd *cobra.Command, args []string) error {
 	opt := timelineOpts
 	var limOpts *madon.LimitParams
 
-	if opt.limit > 0 {
+	if opt.limit > 0 || opt.sinceID > 0 || opt.maxID > 0 {
 		limOpts = new(madon.LimitParams)
+	}
+
+	if opt.limit > 0 {
 		limOpts.Limit = int(opt.limit)
 	}
+	if opt.maxID > 0 {
+		limOpts.MaxID = int(opt.maxID)
+	}
+	if opt.sinceID > 0 {
+		limOpts.SinceID = int(opt.sinceID)
+	}
 
 	tl := "home"
 	if len(args) > 0 {