--- a/cmd/timelines.go Fri Apr 28 13:31:40 2017 +0200
+++ b/cmd/timelines.go Fri Apr 28 15:39:32 2017 +0200
@@ -7,6 +7,8 @@
import (
"github.com/spf13/cobra"
+
+ "github.com/McKael/madon"
)
var timelineOpts struct {
@@ -39,6 +41,12 @@
func timelineRunE(cmd *cobra.Command, args []string) error {
opt := timelineOpts
+ var limOpts *madon.LimitParams
+
+ if opt.limit > 0 {
+ limOpts = new(madon.LimitParams)
+ limOpts.Limit = int(opt.limit)
+ }
tl := "home"
if len(args) > 0 {
@@ -50,13 +58,13 @@
return err
}
- sl, err := gClient.GetTimelines(tl, opt.local)
+ sl, err := gClient.GetTimelines(tl, opt.local, limOpts)
if err != nil {
errPrint("Error: %s", err.Error())
return nil
}
- if opt.limit > 0 {
+ if opt.limit > 0 && len(sl) > int(opt.limit) {
sl = sl[:opt.limit]
}