equal
deleted
inserted
replaced
25 // Maximum number of websockets (1 hashtag <=> 1 ws) |
25 // Maximum number of websockets (1 hashtag <=> 1 ws) |
26 const maximumHashtagStreamWS = 4 |
26 const maximumHashtagStreamWS = 4 |
27 |
27 |
28 // streamCmd represents the stream command |
28 // streamCmd represents the stream command |
29 var streamCmd = &cobra.Command{ |
29 var streamCmd = &cobra.Command{ |
30 Use: "stream [user|local|public|!LIST|:HASHTAG]", |
30 Use: "stream [user|local|public|direct|!LIST|:HASHTAG]", |
31 Short: "Listen to an event stream", |
31 Short: "Listen to an event stream", |
32 Long: `Listen to an event stream |
32 Long: `Listen to an event stream |
33 |
33 |
34 The stream command stays connected to the server and listen to a stream of |
34 The stream command stays connected to the server and listen to a stream of |
35 events (user, local or federated). |
35 events (user, local or federated). |
37 It can also get a hashtag-based stream if the keyword is prefixed with |
37 It can also get a hashtag-based stream if the keyword is prefixed with |
38 ':' or '#'.`, |
38 ':' or '#'.`, |
39 Example: ` madonctl stream # User timeline stream |
39 Example: ` madonctl stream # User timeline stream |
40 madonctl stream local # Local timeline stream |
40 madonctl stream local # Local timeline stream |
41 madonctl stream public # Public timeline stream |
41 madonctl stream public # Public timeline stream |
|
42 madonctl stream direct # Direct messages stream |
42 madonctl stream '!42' # List (ID 42) |
43 madonctl stream '!42' # List (ID 42) |
43 madonctl stream :mastodon # Hashtag |
44 madonctl stream :mastodon # Hashtag |
44 madonctl stream #madonctl |
45 madonctl stream #madonctl |
45 madonctl stream --notifications-only |
46 madonctl stream --notifications-only |
46 madonctl stream --notifications-only --notification-types mentions,follows |
47 madonctl stream --notifications-only --notification-types mentions,follows |
49 Note: madonctl will use 1 websocket per hashtag stream. |
50 Note: madonctl will use 1 websocket per hashtag stream. |
50 madonctl stream #madonctl,#mastodon,#golang |
51 madonctl stream #madonctl,#mastodon,#golang |
51 madonctl stream :madonctl,mastodon,api |
52 madonctl stream :madonctl,mastodon,api |
52 `, |
53 `, |
53 RunE: streamRunE, |
54 RunE: streamRunE, |
54 ValidArgs: []string{"user", "public"}, |
55 ValidArgs: []string{"user", "public", "direct"}, |
55 ArgAliases: []string{"home"}, |
56 ArgAliases: []string{"home"}, |
56 } |
57 } |
57 |
58 |
58 func init() { |
59 func init() { |
59 RootCmd.AddCommand(streamCmd) |
60 RootCmd.AddCommand(streamCmd) |
74 } |
75 } |
75 arg := args[0] |
76 arg := args[0] |
76 switch arg { |
77 switch arg { |
77 case "", "user": |
78 case "", "user": |
78 case "public": |
79 case "public": |
|
80 case "direct": |
79 streamName = arg |
81 streamName = arg |
80 case "local": |
82 case "local": |
81 streamName = "public:local" |
83 streamName = "public:local" |
82 default: |
84 default: |
83 if arg[0] == '!' { |
85 if arg[0] == '!' { |