@@ -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,7 @@ 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 " )
10161026 trackSid := cmd .String ("track" )
10171027 if trackSid == "" {
10181028 trackSid = cmd .Args ().First ()
@@ -1027,32 +1037,36 @@ func muteTrack(ctx context.Context, cmd *cli.Command) error {
10271037 return err
10281038 }
10291039
1030- verb := "muted "
1031- if ! cmd . Bool ( " muted" ) {
1032- verb = "unmuted "
1040+ verb := "Muted "
1041+ if ! muted {
1042+ verb = "Unmuted "
10331043 }
1034- fmt .Println ( verb , " track: " , trackSid )
1044+ fmt .Printf ( "%s track [%s] \n " , verb , trackSid )
10351045 return nil
10361046}
10371047
10381048func updateSubscriptions (ctx context.Context , cmd * cli.Command ) error {
10391049 roomName , identity := participantInfoFromFlags (cmd )
10401050 trackSids := cmd .StringSlice ("track" )
1051+ if cmd .Args ().Len () > 0 {
1052+ trackSids = append (trackSids , cmd .Args ().Slice ()... )
1053+ }
1054+ subscribe := cmd .Bool ("subscribe" ) || ! cmd .Bool ("unsubscribe" )
10411055 _ , err := roomClient .UpdateSubscriptions (ctx , & livekit.UpdateSubscriptionsRequest {
10421056 Room : roomName ,
10431057 Identity : identity ,
10441058 TrackSids : trackSids ,
1045- Subscribe : cmd . Bool ( " subscribe" ) ,
1059+ Subscribe : subscribe ,
10461060 })
10471061 if err != nil {
10481062 return err
10491063 }
10501064
1051- verb := "subscribed to"
1052- if ! cmd . Bool ( " subscribe" ) {
1053- verb = "unsubscribed from"
1065+ verb := "Subscribed to"
1066+ if ! subscribe {
1067+ verb = "Unsubscribed from"
10541068 }
1055- fmt .Println ( verb , " tracks: " , trackSids )
1069+ fmt .Printf ( "%s tracks %v \n " , verb , trackSids )
10561070 return nil
10571071}
10581072
0 commit comments