File tree 1 file changed +16
-1
lines changed
1 file changed +16
-1
lines changed Original file line number Diff line number Diff line change 4
4
"bytes"
5
5
"context"
6
6
"encoding/json"
7
+ "errors"
7
8
"fmt"
8
9
"log/slog"
9
10
"net/http"
@@ -78,7 +79,21 @@ func runFirehose(cctx *cli.Context) error {
78
79
CollectionFilter : cctx .StringSlice ("collection" ),
79
80
}
80
81
81
- relayHost := cctx .String ("relay-host" )
82
+ var relayHost string
83
+ if cctx .IsSet ("relay-host" ) {
84
+ if cctx .Args ().Len () != 0 {
85
+ return errors .New ("error: unused positional args" )
86
+ }
87
+ relayHost = cctx .String ("relay-host" )
88
+ } else {
89
+ if cctx .Args ().Len () == 1 {
90
+ relayHost = cctx .Args ().First ()
91
+ } else if cctx .Args ().Len () > 1 {
92
+ return errors .New ("can only have at most one relay-host" )
93
+ } else {
94
+ relayHost = cctx .String ("relay-host" )
95
+ }
96
+ }
82
97
83
98
dialer := websocket .DefaultDialer
84
99
u , err := url .Parse (relayHost )
You can’t perform that action at this time.
0 commit comments