equal
deleted
inserted
replaced
7 |
7 |
8 import ( |
8 import ( |
9 "errors" |
9 "errors" |
10 |
10 |
11 "github.com/spf13/cobra" |
11 "github.com/spf13/cobra" |
|
12 |
|
13 "github.com/McKael/madon" |
12 ) |
14 ) |
13 |
15 |
14 var notificationsOpts struct { |
16 var notificationsOpts struct { |
15 list, clear bool |
17 list, clear bool |
16 notifID int |
18 notifID int |
49 |
51 |
50 var obj interface{} |
52 var obj interface{} |
51 var err error |
53 var err error |
52 |
54 |
53 if opt.list { |
55 if opt.list { |
54 obj, err = gClient.GetNotifications() |
56 var notifications []madon.Notification |
|
57 notifications, err = gClient.GetNotifications() |
|
58 if accountsOpts.limit > 0 { |
|
59 notifications = notifications[:accountsOpts.limit] |
|
60 } |
|
61 obj = notifications |
55 } else if opt.notifID > 0 { |
62 } else if opt.notifID > 0 { |
56 obj, err = gClient.GetNotification(opt.notifID) |
63 obj, err = gClient.GetNotification(opt.notifID) |
57 } |
64 } |
58 |
65 |
59 if err == nil && opt.clear { |
66 if err == nil && opt.clear { |