Add notification --dismiss to clear a single notification
(Introduced in Mastodon 1.3)
--- a/README.md Fri Apr 28 11:49:22 2017 +0200
+++ b/README.md Fri Apr 28 13:31:40 2017 +0200
@@ -72,6 +72,8 @@
% madonctl accounts blocked # List blocked accounts
% madonctl accounts muted # List muted accounts
% madonctl accounts notifications --list --clear # List and clear notifications
+% madonctl accounts notifications --notification-id 1234 # Display notification
+% madonctl accounts notifications --dismiss --notification-id 1234 # Mastodon 1.3+
```
Update your account information:
--- a/cmd/notifications.go Fri Apr 28 11:49:22 2017 +0200
+++ b/cmd/notifications.go Fri Apr 28 13:31:40 2017 +0200
@@ -14,8 +14,8 @@
)
var notificationsOpts struct {
- list, clear bool
- notifID int
+ list, clear, dismiss bool
+ notifID int
}
// notificationsCmd represents the notifications subcommand
@@ -25,6 +25,7 @@
Short: "Manage notifications",
Example: ` madonctl accounts notifications --list
madonctl accounts notifications --list --clear
+ madonctl accounts notifications --dismiss --notification-id N
madonctl accounts notifications --notification-id N`,
//Long: `TBW...`,
RunE: notificationRunE,
@@ -35,6 +36,7 @@
notificationsCmd.Flags().BoolVar(¬ificationsOpts.list, "list", false, "List all current notifications")
notificationsCmd.Flags().BoolVar(¬ificationsOpts.clear, "clear", false, "Clear all current notifications")
+ notificationsCmd.Flags().BoolVar(¬ificationsOpts.dismiss, "dismiss", false, "Delete a notification")
notificationsCmd.Flags().IntVar(¬ificationsOpts.notifID, "notification-id", 0, "Get a notification")
}
@@ -60,7 +62,11 @@
}
obj = notifications
} else if opt.notifID > 0 {
- obj, err = gClient.GetNotification(opt.notifID)
+ if opt.dismiss {
+ err = gClient.DismissNotification(opt.notifID)
+ } else {
+ obj, err = gClient.GetNotification(opt.notifID)
+ }
}
if err == nil && opt.clear {