# HG changeset patch # User Mikael Berthe # Date 1495362692 -7200 # Node ID 15ecc49bbb254dff0611827f48e75e28a4c4a6a1 # Parent abfa3aa97b51e7e006c0c867f24de63d8b048741 Add stream user --notifications-only diff -r abfa3aa97b51 -r 15ecc49bbb25 cmd/stream.go --- a/cmd/stream.go Sun May 21 12:31:06 2017 +0200 +++ b/cmd/stream.go Sun May 21 12:31:32 2017 +0200 @@ -17,7 +17,8 @@ ) var streamOpts struct { - command string + command string + notificationsOnly bool } // Maximum number of websockets (1 hashtag <=> 1 ws) @@ -51,6 +52,7 @@ RootCmd.AddCommand(streamCmd) streamCmd.Flags().StringVar(&streamOpts.command, "command", "", "Execute external command") + streamCmd.Flags().BoolVar(&streamOpts.notificationsOnly, "notifications-only", false, "Display only notifications (user stream)") } func streamRunE(cmd *cobra.Command, args []string) error { @@ -176,6 +178,9 @@ } errPrint("Event: [%s]", ev.Event) case "update": + if streamOpts.notificationsOnly { + continue + } s := ev.Data.(madon.Status) if err = p.printObj(&s); err != nil { break LISTEN @@ -188,6 +193,9 @@ } continue case "delete": + if streamOpts.notificationsOnly { + continue + } // TODO PrintObj ? errPrint("Event: [%s] Status %d was deleted", ev.Event, ev.Data.(int64)) default: