cmd/status.go
changeset 20 b0ccc09f07a2
parent 15 8ac069eaa817
child 22 5778b09bc6fe
--- a/cmd/status.go	Fri Apr 28 13:31:40 2017 +0200
+++ b/cmd/status.go	Fri Apr 28 15:39:32 2017 +0200
@@ -163,6 +163,14 @@
 	var obj interface{}
 	var err error
 
+	var limOpts *madon.LimitParams
+	if opt.limit > 0 {
+		if limOpts == nil {
+			limOpts = new(madon.LimitParams)
+		}
+		limOpts.Limit = int(opt.limit)
+	}
+
 	switch subcmd {
 	case "show":
 		var status *madon.Status
@@ -178,15 +186,15 @@
 		obj = context
 	case "reblogged-by":
 		var accountList []madon.Account
-		accountList, err = gClient.GetStatusRebloggedBy(opt.statusID)
-		if opt.limit > 0 {
+		accountList, err = gClient.GetStatusRebloggedBy(opt.statusID, limOpts)
+		if opt.limit > 0 && len(accountList) > int(opt.limit) {
 			accountList = accountList[:opt.limit]
 		}
 		obj = accountList
 	case "favourited-by":
 		var accountList []madon.Account
-		accountList, err = gClient.GetStatusFavouritedBy(opt.statusID)
-		if opt.limit > 0 {
+		accountList, err = gClient.GetStatusFavouritedBy(opt.statusID, limOpts)
+		if opt.limit > 0 && len(accountList) > int(opt.limit) {
 			accountList = accountList[:opt.limit]
 		}
 		obj = accountList