@@ -232,13 +232,13 @@ var (
232232 Flags : [][]cli.Flag {
233233 {
234234 & cli.BoolFlag {
235- Name : "m " ,
236- Aliases : []string {"mute" , "muted " },
235+ Name : "mute " ,
236+ Aliases : []string {"m " },
237237 Usage : "Mute the track" ,
238238 },
239239 & cli.BoolFlag {
240- Name : "u " ,
241- Aliases : []string {"unmute " },
240+ Name : "unmute " ,
241+ Aliases : []string {"u " },
242242 Usage : "Unmute the track" ,
243243 },
244244 },
@@ -269,11 +269,21 @@ var (
269269 Name : "track" ,
270270 Usage : "Track `SID` to subscribe/unsubscribe" ,
271271 },
272- & cli.BoolFlag {
273- Name : "subscribe" ,
274- Usage : "Set to true to subscribe, otherwise it'll unsubscribe" ,
275- },
276272 },
273+ MutuallyExclusiveFlags : []cli.MutuallyExclusiveFlags {{
274+ Flags : [][]cli.Flag {{
275+ & cli.BoolFlag {
276+ Name : "subscribe" ,
277+ Aliases : []string {"s" },
278+ Usage : "Subscribe to the track" ,
279+ },
280+ & cli.BoolFlag {
281+ Name : "unsubscribe" ,
282+ Aliases : []string {"S" },
283+ Usage : "Unsubscribe to the track" ,
284+ },
285+ }},
286+ }},
277287 },
278288 {
279289 Name : "send-data" ,
@@ -1012,7 +1022,8 @@ func removeParticipant(ctx context.Context, cmd *cli.Command) error {
10121022
10131023func muteTrack (ctx context.Context , cmd * cli.Command ) error {
10141024 roomName , identity := participantInfoFromFlags (cmd )
1015- muted := (! cmd .IsSet ("m" ) && ! cmd .IsSet ("u" )) || cmd .Bool ("m" ) || ! cmd .Bool ("u" )
1025+ muted := cmd .Bool ("mute" ) || ! cmd .Bool ("unmute" )
1026+ fmt .Printf ("m = %v, u = %v, muted = %v\n " , cmd .Bool ("mute" ), cmd .Bool ("unmute" ), muted )
10161027 trackSid := cmd .String ("track" )
10171028 if trackSid == "" {
10181029 trackSid = cmd .Args ().First ()
@@ -1027,32 +1038,36 @@ func muteTrack(ctx context.Context, cmd *cli.Command) error {
10271038 return err
10281039 }
10291040
1030- verb := "muted "
1031- if ! cmd . Bool ( " muted" ) {
1032- verb = "unmuted "
1041+ verb := "Muted "
1042+ if ! muted {
1043+ verb = "Unmuted "
10331044 }
1034- fmt .Println ( verb , " track: " , trackSid )
1045+ fmt .Printf ( "%s track [%s] \n " , verb , trackSid )
10351046 return nil
10361047}
10371048
10381049func updateSubscriptions (ctx context.Context , cmd * cli.Command ) error {
10391050 roomName , identity := participantInfoFromFlags (cmd )
10401051 trackSids := cmd .StringSlice ("track" )
1052+ if cmd .Args ().Len () > 0 {
1053+ trackSids = append (trackSids , cmd .Args ().Slice ()... )
1054+ }
1055+ subscribe := cmd .Bool ("subscribe" ) || ! cmd .Bool ("unsubscribe" )
10411056 _ , err := roomClient .UpdateSubscriptions (ctx , & livekit.UpdateSubscriptionsRequest {
10421057 Room : roomName ,
10431058 Identity : identity ,
10441059 TrackSids : trackSids ,
1045- Subscribe : cmd . Bool ( " subscribe" ) ,
1060+ Subscribe : subscribe ,
10461061 })
10471062 if err != nil {
10481063 return err
10491064 }
10501065
1051- verb := "subscribed to"
1052- if ! cmd . Bool ( " subscribe" ) {
1053- verb = "unsubscribed from"
1066+ verb := "Subscribed to"
1067+ if ! subscribe {
1068+ verb = "Unsubscribed from"
10541069 }
1055- fmt .Println ( verb , " tracks: " , trackSids )
1070+ fmt .Printf ( "%s tracks %v \n " , verb , trackSids )
10561071 return nil
10571072}
10581073
0 commit comments