author | Mikael Berthe <mikael@lilotux.net> |
Sat, 15 Jul 2017 21:58:24 +0200 | |
changeset 166 | 79c0f8db66ff |
parent 144 | 15ecc49bbb25 |
child 174 | 0b30e670aa82 |
permissions | -rw-r--r-- |
0 | 1 |
// Copyright © 2017 Mikael Berthe <mikael@lilotux.net> |
2 |
// |
|
3 |
// Licensed under the MIT license. |
|
4 |
// Please see the LICENSE file is this directory. |
|
5 |
||
6 |
package cmd |
|
7 |
||
8 |
import ( |
|
9 |
"io" |
|
47
82d8b6074309
Set exit code to non-zero when API calls fail
Mikael Berthe <mikael@lilotux.net>
parents:
45
diff
changeset
|
10 |
"os" |
74
78e1c63e4bbe
Add support for several hashtag streams
Mikael Berthe <mikael@lilotux.net>
parents:
47
diff
changeset
|
11 |
"strings" |
0 | 12 |
|
45
b58a7ea1aeb2
Use github.com/pkg/errors
Mikael Berthe <mikael@lilotux.net>
parents:
44
diff
changeset
|
13 |
"github.com/pkg/errors" |
0 | 14 |
"github.com/spf13/cobra" |
15 |
||
16 |
"github.com/McKael/madon" |
|
17 |
) |
|
18 |
||
19 |
var streamOpts struct { |
|
144
15ecc49bbb25
Add stream user --notifications-only
Mikael Berthe <mikael@lilotux.net>
parents:
112
diff
changeset
|
20 |
command string |
15ecc49bbb25
Add stream user --notifications-only
Mikael Berthe <mikael@lilotux.net>
parents:
112
diff
changeset
|
21 |
notificationsOnly bool |
166
79c0f8db66ff
Add --notification-types to the stream command as well
Mikael Berthe <mikael@lilotux.net>
parents:
144
diff
changeset
|
22 |
notificationTypes string |
0 | 23 |
} |
24 |
||
74
78e1c63e4bbe
Add support for several hashtag streams
Mikael Berthe <mikael@lilotux.net>
parents:
47
diff
changeset
|
25 |
// Maximum number of websockets (1 hashtag <=> 1 ws) |
78e1c63e4bbe
Add support for several hashtag streams
Mikael Berthe <mikael@lilotux.net>
parents:
47
diff
changeset
|
26 |
const maximumHashtagStreamWS = 4 |
78e1c63e4bbe
Add support for several hashtag streams
Mikael Berthe <mikael@lilotux.net>
parents:
47
diff
changeset
|
27 |
|
0 | 28 |
// streamCmd represents the stream command |
29 |
var streamCmd = &cobra.Command{ |
|
30 |
Use: "stream [user|local|public|:HASHTAG]", |
|
31 |
Short: "Listen to an event stream", |
|
32 |
Long: ` |
|
33 |
The stream command stays connected to the server and listen to a stream of |
|
34 |
events (user, local or federated). |
|
35 |
It can also get a hashtag-based stream if the keyword or prefixed with |
|
36 |
':' or '#'.`, |
|
37 |
Example: ` madonctl stream # User timeline stream |
|
38 |
madonctl stream local # Local timeline stream |
|
39 |
madonctl stream public # Public timeline stream |
|
40 |
madonctl stream :mastodon # Hashtag |
|
74
78e1c63e4bbe
Add support for several hashtag streams
Mikael Berthe <mikael@lilotux.net>
parents:
47
diff
changeset
|
41 |
madonctl stream #madonctl |
166
79c0f8db66ff
Add --notification-types to the stream command as well
Mikael Berthe <mikael@lilotux.net>
parents:
144
diff
changeset
|
42 |
madonctl stream --notifications-only |
79c0f8db66ff
Add --notification-types to the stream command as well
Mikael Berthe <mikael@lilotux.net>
parents:
144
diff
changeset
|
43 |
madonctl stream --notifications-only --notification-types mentions,follows |
74
78e1c63e4bbe
Add support for several hashtag streams
Mikael Berthe <mikael@lilotux.net>
parents:
47
diff
changeset
|
44 |
|
78e1c63e4bbe
Add support for several hashtag streams
Mikael Berthe <mikael@lilotux.net>
parents:
47
diff
changeset
|
45 |
Several (up to 4) hashtags can be given. |
78e1c63e4bbe
Add support for several hashtag streams
Mikael Berthe <mikael@lilotux.net>
parents:
47
diff
changeset
|
46 |
Note: madonctl will use 1 websocket per hashtag stream. |
78e1c63e4bbe
Add support for several hashtag streams
Mikael Berthe <mikael@lilotux.net>
parents:
47
diff
changeset
|
47 |
madonctl stream #madonctl,#mastodon,#golang |
78e1c63e4bbe
Add support for several hashtag streams
Mikael Berthe <mikael@lilotux.net>
parents:
47
diff
changeset
|
48 |
madonctl stream :madonctl,mastodon,api`, |
0 | 49 |
RunE: streamRunE, |
50 |
ValidArgs: []string{"user", "public"}, |
|
51 |
ArgAliases: []string{"home"}, |
|
52 |
} |
|
53 |
||
54 |
func init() { |
|
55 |
RootCmd.AddCommand(streamCmd) |
|
56 |
||
112
58d30ab47543
Add flag --command to the stream command
Mikael Berthe <mikael@lilotux.net>
parents:
110
diff
changeset
|
57 |
streamCmd.Flags().StringVar(&streamOpts.command, "command", "", "Execute external command") |
144
15ecc49bbb25
Add stream user --notifications-only
Mikael Berthe <mikael@lilotux.net>
parents:
112
diff
changeset
|
58 |
streamCmd.Flags().BoolVar(&streamOpts.notificationsOnly, "notifications-only", false, "Display only notifications (user stream)") |
166
79c0f8db66ff
Add --notification-types to the stream command as well
Mikael Berthe <mikael@lilotux.net>
parents:
144
diff
changeset
|
59 |
streamCmd.Flags().StringVar(&streamOpts.notificationTypes, "notification-types", "", "Filter notifications (mentions, favourites, reblogs, follows)") |
0 | 60 |
} |
61 |
||
62 |
func streamRunE(cmd *cobra.Command, args []string) error { |
|
63 |
streamName := "user" |
|
64 |
tag := "" |
|
74
78e1c63e4bbe
Add support for several hashtag streams
Mikael Berthe <mikael@lilotux.net>
parents:
47
diff
changeset
|
65 |
var hashTagList []string |
0 | 66 |
|
67 |
if len(args) > 0 { |
|
68 |
if len(args) != 1 { |
|
69 |
return errors.New("too many parameters") |
|
70 |
} |
|
71 |
arg := args[0] |
|
72 |
switch arg { |
|
73 |
case "", "user": |
|
74 |
case "public": |
|
75 |
streamName = arg |
|
76 |
case "local": |
|
77 |
streamName = "public:local" |
|
78 |
default: |
|
79 |
if arg[0] != ':' && arg[0] != '#' { |
|
80 |
return errors.New("invalid argument") |
|
81 |
} |
|
82 |
streamName = "hashtag" |
|
83 |
tag = arg[1:] |
|
84 |
if len(tag) == 0 { |
|
85 |
return errors.New("empty hashtag") |
|
86 |
} |
|
74
78e1c63e4bbe
Add support for several hashtag streams
Mikael Berthe <mikael@lilotux.net>
parents:
47
diff
changeset
|
87 |
hashTagList = strings.Split(tag, ",") |
78e1c63e4bbe
Add support for several hashtag streams
Mikael Berthe <mikael@lilotux.net>
parents:
47
diff
changeset
|
88 |
for i, h := range hashTagList { |
78e1c63e4bbe
Add support for several hashtag streams
Mikael Berthe <mikael@lilotux.net>
parents:
47
diff
changeset
|
89 |
if h[0] == ':' || h[0] == '#' { |
78e1c63e4bbe
Add support for several hashtag streams
Mikael Berthe <mikael@lilotux.net>
parents:
47
diff
changeset
|
90 |
hashTagList[i] = h[1:] |
78e1c63e4bbe
Add support for several hashtag streams
Mikael Berthe <mikael@lilotux.net>
parents:
47
diff
changeset
|
91 |
} |
78e1c63e4bbe
Add support for several hashtag streams
Mikael Berthe <mikael@lilotux.net>
parents:
47
diff
changeset
|
92 |
if h == "" { |
78e1c63e4bbe
Add support for several hashtag streams
Mikael Berthe <mikael@lilotux.net>
parents:
47
diff
changeset
|
93 |
return errors.New("empty hashtag") |
78e1c63e4bbe
Add support for several hashtag streams
Mikael Berthe <mikael@lilotux.net>
parents:
47
diff
changeset
|
94 |
} |
78e1c63e4bbe
Add support for several hashtag streams
Mikael Berthe <mikael@lilotux.net>
parents:
47
diff
changeset
|
95 |
} |
78e1c63e4bbe
Add support for several hashtag streams
Mikael Berthe <mikael@lilotux.net>
parents:
47
diff
changeset
|
96 |
if len(hashTagList) > maximumHashtagStreamWS { |
78e1c63e4bbe
Add support for several hashtag streams
Mikael Berthe <mikael@lilotux.net>
parents:
47
diff
changeset
|
97 |
return errors.Errorf("too many hashtags, maximum is %d", maximumHashtagStreamWS) |
78e1c63e4bbe
Add support for several hashtag streams
Mikael Berthe <mikael@lilotux.net>
parents:
47
diff
changeset
|
98 |
} |
0 | 99 |
} |
100 |
} |
|
101 |
||
102 |
if err := madonInit(true); err != nil { |
|
103 |
return err |
|
104 |
} |
|
105 |
||
166
79c0f8db66ff
Add --notification-types to the stream command as well
Mikael Berthe <mikael@lilotux.net>
parents:
144
diff
changeset
|
106 |
var filterMap *map[string]bool |
79c0f8db66ff
Add --notification-types to the stream command as well
Mikael Berthe <mikael@lilotux.net>
parents:
144
diff
changeset
|
107 |
if streamOpts.notificationTypes != "" { |
79c0f8db66ff
Add --notification-types to the stream command as well
Mikael Berthe <mikael@lilotux.net>
parents:
144
diff
changeset
|
108 |
var err error |
79c0f8db66ff
Add --notification-types to the stream command as well
Mikael Berthe <mikael@lilotux.net>
parents:
144
diff
changeset
|
109 |
filterMap, err = buildFilterMap(streamOpts.notificationTypes) |
79c0f8db66ff
Add --notification-types to the stream command as well
Mikael Berthe <mikael@lilotux.net>
parents:
144
diff
changeset
|
110 |
if err != nil { |
79c0f8db66ff
Add --notification-types to the stream command as well
Mikael Berthe <mikael@lilotux.net>
parents:
144
diff
changeset
|
111 |
return err |
79c0f8db66ff
Add --notification-types to the stream command as well
Mikael Berthe <mikael@lilotux.net>
parents:
144
diff
changeset
|
112 |
} |
79c0f8db66ff
Add --notification-types to the stream command as well
Mikael Berthe <mikael@lilotux.net>
parents:
144
diff
changeset
|
113 |
} |
79c0f8db66ff
Add --notification-types to the stream command as well
Mikael Berthe <mikael@lilotux.net>
parents:
144
diff
changeset
|
114 |
|
0 | 115 |
evChan := make(chan madon.StreamEvent, 10) |
116 |
stop := make(chan bool) |
|
117 |
done := make(chan bool) |
|
74
78e1c63e4bbe
Add support for several hashtag streams
Mikael Berthe <mikael@lilotux.net>
parents:
47
diff
changeset
|
118 |
var err error |
0 | 119 |
|
74
78e1c63e4bbe
Add support for several hashtag streams
Mikael Berthe <mikael@lilotux.net>
parents:
47
diff
changeset
|
120 |
if streamName != "hashtag" || len(hashTagList) <= 1 { // Usual case: Only 1 stream |
78e1c63e4bbe
Add support for several hashtag streams
Mikael Berthe <mikael@lilotux.net>
parents:
47
diff
changeset
|
121 |
err = gClient.StreamListener(streamName, tag, evChan, stop, done) |
78e1c63e4bbe
Add support for several hashtag streams
Mikael Berthe <mikael@lilotux.net>
parents:
47
diff
changeset
|
122 |
} else { // Several streams |
78e1c63e4bbe
Add support for several hashtag streams
Mikael Berthe <mikael@lilotux.net>
parents:
47
diff
changeset
|
123 |
n := len(hashTagList) |
78e1c63e4bbe
Add support for several hashtag streams
Mikael Berthe <mikael@lilotux.net>
parents:
47
diff
changeset
|
124 |
tagEvCh := make([]chan madon.StreamEvent, n) |
78e1c63e4bbe
Add support for several hashtag streams
Mikael Berthe <mikael@lilotux.net>
parents:
47
diff
changeset
|
125 |
tagDoneCh := make([]chan bool, n) |
78e1c63e4bbe
Add support for several hashtag streams
Mikael Berthe <mikael@lilotux.net>
parents:
47
diff
changeset
|
126 |
for i, t := range hashTagList { |
78e1c63e4bbe
Add support for several hashtag streams
Mikael Berthe <mikael@lilotux.net>
parents:
47
diff
changeset
|
127 |
if verbose { |
78e1c63e4bbe
Add support for several hashtag streams
Mikael Berthe <mikael@lilotux.net>
parents:
47
diff
changeset
|
128 |
errPrint("Launching listener for tag '%s'", t) |
78e1c63e4bbe
Add support for several hashtag streams
Mikael Berthe <mikael@lilotux.net>
parents:
47
diff
changeset
|
129 |
} |
78e1c63e4bbe
Add support for several hashtag streams
Mikael Berthe <mikael@lilotux.net>
parents:
47
diff
changeset
|
130 |
tagEvCh[i] = make(chan madon.StreamEvent) |
103
7a4604bb12d9
Fix panic when a streaming connection is closed (in multi-streams)
Mikael Berthe <mikael@lilotux.net>
parents:
81
diff
changeset
|
131 |
tagDoneCh[i] = make(chan bool) |
74
78e1c63e4bbe
Add support for several hashtag streams
Mikael Berthe <mikael@lilotux.net>
parents:
47
diff
changeset
|
132 |
e := gClient.StreamListener(streamName, t, tagEvCh[i], stop, tagDoneCh[i]) |
78e1c63e4bbe
Add support for several hashtag streams
Mikael Berthe <mikael@lilotux.net>
parents:
47
diff
changeset
|
133 |
if e != nil { |
78e1c63e4bbe
Add support for several hashtag streams
Mikael Berthe <mikael@lilotux.net>
parents:
47
diff
changeset
|
134 |
if i > 0 { // Close previous connections |
78e1c63e4bbe
Add support for several hashtag streams
Mikael Berthe <mikael@lilotux.net>
parents:
47
diff
changeset
|
135 |
close(stop) |
78e1c63e4bbe
Add support for several hashtag streams
Mikael Berthe <mikael@lilotux.net>
parents:
47
diff
changeset
|
136 |
} |
78e1c63e4bbe
Add support for several hashtag streams
Mikael Berthe <mikael@lilotux.net>
parents:
47
diff
changeset
|
137 |
err = e |
78e1c63e4bbe
Add support for several hashtag streams
Mikael Berthe <mikael@lilotux.net>
parents:
47
diff
changeset
|
138 |
break |
78e1c63e4bbe
Add support for several hashtag streams
Mikael Berthe <mikael@lilotux.net>
parents:
47
diff
changeset
|
139 |
} |
78e1c63e4bbe
Add support for several hashtag streams
Mikael Berthe <mikael@lilotux.net>
parents:
47
diff
changeset
|
140 |
// Forward events to main ev channel |
78e1c63e4bbe
Add support for several hashtag streams
Mikael Berthe <mikael@lilotux.net>
parents:
47
diff
changeset
|
141 |
go func(i int) { |
78e1c63e4bbe
Add support for several hashtag streams
Mikael Berthe <mikael@lilotux.net>
parents:
47
diff
changeset
|
142 |
for { |
78e1c63e4bbe
Add support for several hashtag streams
Mikael Berthe <mikael@lilotux.net>
parents:
47
diff
changeset
|
143 |
select { |
78e1c63e4bbe
Add support for several hashtag streams
Mikael Berthe <mikael@lilotux.net>
parents:
47
diff
changeset
|
144 |
case _, ok := <-tagDoneCh[i]: |
78e1c63e4bbe
Add support for several hashtag streams
Mikael Berthe <mikael@lilotux.net>
parents:
47
diff
changeset
|
145 |
if !ok { // end of streaming for this tag |
78e1c63e4bbe
Add support for several hashtag streams
Mikael Berthe <mikael@lilotux.net>
parents:
47
diff
changeset
|
146 |
done <- true |
78e1c63e4bbe
Add support for several hashtag streams
Mikael Berthe <mikael@lilotux.net>
parents:
47
diff
changeset
|
147 |
return |
78e1c63e4bbe
Add support for several hashtag streams
Mikael Berthe <mikael@lilotux.net>
parents:
47
diff
changeset
|
148 |
} |
78e1c63e4bbe
Add support for several hashtag streams
Mikael Berthe <mikael@lilotux.net>
parents:
47
diff
changeset
|
149 |
case ev := <-tagEvCh[i]: |
78e1c63e4bbe
Add support for several hashtag streams
Mikael Berthe <mikael@lilotux.net>
parents:
47
diff
changeset
|
150 |
evChan <- ev |
78e1c63e4bbe
Add support for several hashtag streams
Mikael Berthe <mikael@lilotux.net>
parents:
47
diff
changeset
|
151 |
} |
78e1c63e4bbe
Add support for several hashtag streams
Mikael Berthe <mikael@lilotux.net>
parents:
47
diff
changeset
|
152 |
} |
78e1c63e4bbe
Add support for several hashtag streams
Mikael Berthe <mikael@lilotux.net>
parents:
47
diff
changeset
|
153 |
}(i) |
78e1c63e4bbe
Add support for several hashtag streams
Mikael Berthe <mikael@lilotux.net>
parents:
47
diff
changeset
|
154 |
} |
78e1c63e4bbe
Add support for several hashtag streams
Mikael Berthe <mikael@lilotux.net>
parents:
47
diff
changeset
|
155 |
} |
78e1c63e4bbe
Add support for several hashtag streams
Mikael Berthe <mikael@lilotux.net>
parents:
47
diff
changeset
|
156 |
|
0 | 157 |
if err != nil { |
158 |
errPrint("Error: %s", err.Error()) |
|
47
82d8b6074309
Set exit code to non-zero when API calls fail
Mikael Berthe <mikael@lilotux.net>
parents:
45
diff
changeset
|
159 |
os.Exit(1) |
0 | 160 |
} |
161 |
||
162 |
p, err := getPrinter() |
|
163 |
if err != nil { |
|
164 |
close(stop) |
|
165 |
<-done |
|
166 |
close(evChan) |
|
81
b1671f83e91b
Do not display usage when GetPrinter fails
Mikael Berthe <mikael@lilotux.net>
parents:
74
diff
changeset
|
167 |
errPrint("Error: %s", err.Error()) |
b1671f83e91b
Do not display usage when GetPrinter fails
Mikael Berthe <mikael@lilotux.net>
parents:
74
diff
changeset
|
168 |
os.Exit(1) |
0 | 169 |
} |
170 |
||
112
58d30ab47543
Add flag --command to the stream command
Mikael Berthe <mikael@lilotux.net>
parents:
110
diff
changeset
|
171 |
// Set up external command |
58d30ab47543
Add flag --command to the stream command
Mikael Berthe <mikael@lilotux.net>
parents:
110
diff
changeset
|
172 |
p.setCommand(streamOpts.command) |
58d30ab47543
Add flag --command to the stream command
Mikael Berthe <mikael@lilotux.net>
parents:
110
diff
changeset
|
173 |
|
0 | 174 |
LISTEN: |
175 |
for { |
|
176 |
select { |
|
103
7a4604bb12d9
Fix panic when a streaming connection is closed (in multi-streams)
Mikael Berthe <mikael@lilotux.net>
parents:
81
diff
changeset
|
177 |
case v, ok := <-done: |
7a4604bb12d9
Fix panic when a streaming connection is closed (in multi-streams)
Mikael Berthe <mikael@lilotux.net>
parents:
81
diff
changeset
|
178 |
if !ok || v == true { // done is closed, end of streaming |
0 | 179 |
break LISTEN |
180 |
} |
|
181 |
case ev := <-evChan: |
|
182 |
switch ev.Event { |
|
183 |
case "error": |
|
184 |
if ev.Error != nil { |
|
185 |
if ev.Error == io.ErrUnexpectedEOF { |
|
186 |
errPrint("The stream connection was unexpectedly closed") |
|
187 |
continue |
|
188 |
} |
|
189 |
errPrint("Error event: [%s] %s", ev.Event, ev.Error) |
|
190 |
continue |
|
191 |
} |
|
192 |
errPrint("Event: [%s]", ev.Event) |
|
193 |
case "update": |
|
144
15ecc49bbb25
Add stream user --notifications-only
Mikael Berthe <mikael@lilotux.net>
parents:
112
diff
changeset
|
194 |
if streamOpts.notificationsOnly { |
15ecc49bbb25
Add stream user --notifications-only
Mikael Berthe <mikael@lilotux.net>
parents:
112
diff
changeset
|
195 |
continue |
15ecc49bbb25
Add stream user --notifications-only
Mikael Berthe <mikael@lilotux.net>
parents:
112
diff
changeset
|
196 |
} |
0 | 197 |
s := ev.Data.(madon.Status) |
112
58d30ab47543
Add flag --command to the stream command
Mikael Berthe <mikael@lilotux.net>
parents:
110
diff
changeset
|
198 |
if err = p.printObj(&s); err != nil { |
58d30ab47543
Add flag --command to the stream command
Mikael Berthe <mikael@lilotux.net>
parents:
110
diff
changeset
|
199 |
break LISTEN |
58d30ab47543
Add flag --command to the stream command
Mikael Berthe <mikael@lilotux.net>
parents:
110
diff
changeset
|
200 |
} |
0 | 201 |
continue |
202 |
case "notification": |
|
203 |
n := ev.Data.(madon.Notification) |
|
166
79c0f8db66ff
Add --notification-types to the stream command as well
Mikael Berthe <mikael@lilotux.net>
parents:
144
diff
changeset
|
204 |
if filterMap != nil && !(*filterMap)[n.Type] { |
79c0f8db66ff
Add --notification-types to the stream command as well
Mikael Berthe <mikael@lilotux.net>
parents:
144
diff
changeset
|
205 |
continue |
79c0f8db66ff
Add --notification-types to the stream command as well
Mikael Berthe <mikael@lilotux.net>
parents:
144
diff
changeset
|
206 |
} |
112
58d30ab47543
Add flag --command to the stream command
Mikael Berthe <mikael@lilotux.net>
parents:
110
diff
changeset
|
207 |
if p.printObj(&n); err != nil { |
58d30ab47543
Add flag --command to the stream command
Mikael Berthe <mikael@lilotux.net>
parents:
110
diff
changeset
|
208 |
break LISTEN |
58d30ab47543
Add flag --command to the stream command
Mikael Berthe <mikael@lilotux.net>
parents:
110
diff
changeset
|
209 |
} |
0 | 210 |
continue |
211 |
case "delete": |
|
144
15ecc49bbb25
Add stream user --notifications-only
Mikael Berthe <mikael@lilotux.net>
parents:
112
diff
changeset
|
212 |
if streamOpts.notificationsOnly { |
15ecc49bbb25
Add stream user --notifications-only
Mikael Berthe <mikael@lilotux.net>
parents:
112
diff
changeset
|
213 |
continue |
15ecc49bbb25
Add stream user --notifications-only
Mikael Berthe <mikael@lilotux.net>
parents:
112
diff
changeset
|
214 |
} |
0 | 215 |
// TODO PrintObj ? |
44
6da40ca4534c
Sync with Madon; switch IDs to int64 integers
Mikael Berthe <mikael@lilotux.net>
parents:
0
diff
changeset
|
216 |
errPrint("Event: [%s] Status %d was deleted", ev.Event, ev.Data.(int64)) |
0 | 217 |
default: |
218 |
errPrint("Unhandled event: [%s] %T", ev.Event, ev.Data) |
|
219 |
} |
|
220 |
} |
|
221 |
} |
|
74
78e1c63e4bbe
Add support for several hashtag streams
Mikael Berthe <mikael@lilotux.net>
parents:
47
diff
changeset
|
222 |
close(stop) |
0 | 223 |
close(evChan) |
112
58d30ab47543
Add flag --command to the stream command
Mikael Berthe <mikael@lilotux.net>
parents:
110
diff
changeset
|
224 |
if err != nil { |
58d30ab47543
Add flag --command to the stream command
Mikael Berthe <mikael@lilotux.net>
parents:
110
diff
changeset
|
225 |
errPrint("Error: %s", err.Error()) |
58d30ab47543
Add flag --command to the stream command
Mikael Berthe <mikael@lilotux.net>
parents:
110
diff
changeset
|
226 |
os.Exit(1) |
58d30ab47543
Add flag --command to the stream command
Mikael Berthe <mikael@lilotux.net>
parents:
110
diff
changeset
|
227 |
} |
0 | 228 |
return nil |
229 |
} |