--- a/cmd/accounts.go Fri Apr 28 15:53:09 2017 +0200
+++ b/cmd/accounts.go Fri Apr 28 16:56:33 2017 +0200
@@ -20,7 +20,7 @@
accountID int
accountUID string
unset bool // TODO remove eventually?
- limit uint // Limit the number of results
+ limit, sinceID, maxID uint // Limit the results
onlyMedia, excludeReplies bool // For acccount statuses
remoteUID string // For account follow
acceptFR, rejectFR bool // For account follow_requests
@@ -45,6 +45,8 @@
accountsCmd.PersistentFlags().IntVarP(&accountsOpts.accountID, "account-id", "a", 0, "Account ID number")
accountsCmd.PersistentFlags().StringVarP(&accountsOpts.accountUID, "user-id", "u", "", "Account user ID")
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")
// Subcommand flags
accountStatusesSubcommand.Flags().BoolVar(&accountsOpts.onlyMedia, "only-media", false, "Only statuses with media attachments")
@@ -238,7 +240,6 @@
// accountSubcommandsRunE is a generic function for status subcommands
func accountSubcommandsRunE(subcmd string, args []string) error {
opt := accountsOpts
- var limOpts *madon.LimitParams
if opt.accountUID != "" {
if opt.accountID > 0 {
@@ -326,12 +327,20 @@
}
}
+ var limOpts *madon.LimitParams
+ if opt.limit > 0 || opt.sinceID > 0 || opt.maxID > 0 {
+ limOpts = new(madon.LimitParams)
+ }
+
if opt.limit > 0 {
- if limOpts == nil {
- limOpts = new(madon.LimitParams)
- }
limOpts.Limit = int(opt.limit)
}
+ if opt.maxID > 0 {
+ limOpts.MaxID = int(opt.maxID)
+ }
+ if opt.sinceID > 0 {
+ limOpts.SinceID = int(opt.sinceID)
+ }
// All account subcommands need to have signed in
if err := madonInit(true); err != nil {
--- a/cmd/notifications.go Fri Apr 28 15:53:09 2017 +0200
+++ b/cmd/notifications.go Fri Apr 28 16:56:33 2017 +0200
@@ -42,7 +42,6 @@
func notificationRunE(cmd *cobra.Command, args []string) error {
opt := notificationsOpts
- var limOpts *madon.LimitParams
if !opt.list && !opt.clear && opt.notifID < 1 {
return errors.New("missing parameters")
@@ -52,10 +51,20 @@
return err
}
- if accountsOpts.limit > 0 {
+ var limOpts *madon.LimitParams
+ if accountsOpts.limit > 0 || accountsOpts.sinceID > 0 || accountsOpts.maxID > 0 {
limOpts = new(madon.LimitParams)
+ }
+
+ if accountsOpts.limit > 0 {
limOpts.Limit = int(accountsOpts.limit)
}
+ if accountsOpts.maxID > 0 {
+ limOpts.MaxID = int(accountsOpts.maxID)
+ }
+ if accountsOpts.sinceID > 0 {
+ limOpts.SinceID = int(accountsOpts.sinceID)
+ }
var obj interface{}
var err error
--- a/cmd/status.go Fri Apr 28 15:53:09 2017 +0200
+++ b/cmd/status.go Fri Apr 28 16:56:33 2017 +0200
@@ -30,6 +30,7 @@
// Used for several subcommands to limit the number of results
limit uint
+ //sinceID, maxID uint
}
func init() {
@@ -41,6 +42,8 @@
// Global flags
statusCmd.PersistentFlags().IntVarP(&statusOpts.statusID, "status-id", "s", 0, "Status ID number")
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.MarkPersistentFlagRequired("status-id")
@@ -164,12 +167,21 @@
var err error
var limOpts *madon.LimitParams
+ if opt.limit > 0 /* || opt.sinceID > 0 || opt.maxID > 0 */ {
+ limOpts = new(madon.LimitParams)
+ }
+
if opt.limit > 0 {
- if limOpts == nil {
- limOpts = new(madon.LimitParams)
- }
limOpts.Limit = int(opt.limit)
}
+ /*
+ if opt.maxID > 0 {
+ limOpts.MaxID = int(opt.maxID)
+ }
+ if opt.sinceID > 0 {
+ limOpts.SinceID = int(opt.sinceID)
+ }
+ */
switch subcmd {
case "show":
--- 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 {