Add option --all to fetch all available results
authorMikael Berthe <mikael@lilotux.net>
Sat, 29 Apr 2017 17:32:37 +0200
changeset 30 14561d44211b
parent 29 4f12e5d4ef75
child 31 9dcb4491d7a1
Add option --all to fetch all available results This patch adds support for: - madonctl accounts --all followers - madonctl accounts --all following - madonctl accounts --all statuses - madonctl accounts --all blocks - madonctl accounts --all favourites - madonctl accounts --all mutes - madonctl accounts notifications --list --all - madonctl status --status-id STATUSID --all reblogged-by - madonctl status --status-id STATUSID --all favourited-by
cmd/accounts.go
cmd/notifications.go
cmd/status.go
--- a/cmd/accounts.go	Sat Apr 29 17:20:19 2017 +0200
+++ b/cmd/accounts.go	Sat Apr 29 17:32:37 2017 +0200
@@ -21,6 +21,7 @@
 	accountUID                string
 	unset                     bool   // TODO remove eventually?
 	limit, sinceID, maxID     uint   // Limit the results
+	all                       bool   // Try to fetch all results
 	onlyMedia, excludeReplies bool   // For acccount statuses
 	remoteUID                 string // For account follow
 	acceptFR, rejectFR        bool   // For account follow_requests
@@ -47,6 +48,7 @@
 	accountsCmd.PersistentFlags().UintVarP(&accountsOpts.limit, "limit", "l", 0, "Limit number of results")
 	accountsCmd.PersistentFlags().UintVar(&accountsOpts.sinceID, "since-id", 0, "Request IDs greater than a value")
 	accountsCmd.PersistentFlags().UintVar(&accountsOpts.maxID, "max-id", 0, "Request IDs less (or equal) than a value")
+	accountsCmd.PersistentFlags().BoolVar(&accountsOpts.all, "all", false, "Fetch all results")
 
 	// Subcommand flags
 	accountStatusesSubcommand.Flags().BoolVar(&accountsOpts.onlyMedia, "only-media", false, "Only statuses with media attachments")
@@ -344,8 +346,9 @@
 	}
 
 	var limOpts *madon.LimitParams
-	if opt.limit > 0 || opt.sinceID > 0 || opt.maxID > 0 {
+	if opt.all || opt.limit > 0 || opt.sinceID > 0 || opt.maxID > 0 {
 		limOpts = new(madon.LimitParams)
+		limOpts.All = opt.all
 	}
 
 	if opt.limit > 0 {
--- a/cmd/notifications.go	Sat Apr 29 17:20:19 2017 +0200
+++ b/cmd/notifications.go	Sat Apr 29 17:32:37 2017 +0200
@@ -52,8 +52,9 @@
 	}
 
 	var limOpts *madon.LimitParams
-	if accountsOpts.limit > 0 || accountsOpts.sinceID > 0 || accountsOpts.maxID > 0 {
+	if accountsOpts.all || accountsOpts.limit > 0 || accountsOpts.sinceID > 0 || accountsOpts.maxID > 0 {
 		limOpts = new(madon.LimitParams)
+		limOpts.All = accountsOpts.all
 	}
 
 	if accountsOpts.limit > 0 {
--- a/cmd/status.go	Sat Apr 29 17:20:19 2017 +0200
+++ b/cmd/status.go	Sat Apr 29 17:32:37 2017 +0200
@@ -31,6 +31,7 @@
 	// Used for several subcommands to limit the number of results
 	limit uint
 	//sinceID, maxID uint
+	all bool
 }
 
 func init() {
@@ -44,6 +45,7 @@
 	statusCmd.PersistentFlags().UintVarP(&statusOpts.limit, "limit", "l", 0, "Limit number of results")
 	//statusCmd.PersistentFlags().UintVar(&statusOpts.sinceID, "since-id", 0, "Request IDs greater than a value")
 	//statusCmd.PersistentFlags().UintVar(&statusOpts.maxID, "max-id", 0, "Request IDs less (or equal) than a value")
+	statusCmd.PersistentFlags().BoolVar(&statusOpts.all, "all", false, "Fetch all results (for reblogged-by/favourited-by)")
 
 	statusCmd.MarkPersistentFlagRequired("status-id")
 
@@ -167,8 +169,9 @@
 	var err error
 
 	var limOpts *madon.LimitParams
-	if opt.limit > 0 /* || opt.sinceID > 0 || opt.maxID > 0 */ {
+	if opt.all || opt.limit > 0 /* || opt.sinceID > 0 || opt.maxID > 0 */ {
 		limOpts = new(madon.LimitParams)
+		limOpts.All = opt.all
 	}
 
 	if opt.limit > 0 {