@@ -229,6 +229,26 @@ func execCmd(nc *nexus.NexusConn, parsed string) {
229
229
table .Render ()
230
230
}
231
231
232
+ case taskCount .FullCommand ():
233
+ if res , err := nc .TaskCount (* taskCountPrefix , & nexus.CountOpts {Subprefixes : * taskCountSubprefixes , Filter : * taskCountFilter }); err != nil {
234
+ log .Println (err )
235
+ return
236
+ } else {
237
+ table := tablewriter .NewWriter (os .Stdout )
238
+ table .SetHeader ([]string {"Prefix" , "Count" , "PushCount" , "PullCount" })
239
+ table .SetBorders (tablewriter.Border {Left : false , Top : false , Right : false , Bottom : false })
240
+
241
+ if * taskCountSubprefixes {
242
+ for _ , el := range ei .N (res ).SliceZ () {
243
+ table .Append ([]string {ei .N (el ).M ("prefix" ).StringZ (), fmt .Sprintf ("%d" , ei .N (el ).M ("count" ).IntZ ()), fmt .Sprintf ("%d" , ei .N (el ).M ("pushCount" ).IntZ ()), fmt .Sprintf ("%d" , ei .N (el ).M ("pullCount" ).IntZ ())})
244
+ }
245
+ } else {
246
+ table .Append ([]string {* taskCountPrefix , fmt .Sprintf ("%d" , ei .N (res ).M ("count" ).IntZ ()), fmt .Sprintf ("%d" , ei .N (res ).M ("pushCount" ).IntZ ()), fmt .Sprintf ("%d" , ei .N (res ).M ("pullCount" ).IntZ ())})
247
+ }
248
+
249
+ table .Render ()
250
+ }
251
+
232
252
case pipeWrite .FullCommand ():
233
253
// Clean afterwards in case we are looping on shell mode
234
254
defer func () { * pipeWriteData = []string {} }()
@@ -340,6 +360,26 @@ func execCmd(nc *nexus.NexusConn, parsed string) {
340
360
fmt .Println ()
341
361
}
342
362
363
+ case userCount .FullCommand ():
364
+ if res , err := nc .UserCount (* userCountPrefix , & nexus.CountOpts {Subprefixes : * userCountSubprefixes , Filter : * userCountFilter }); err != nil {
365
+ log .Println (err )
366
+ return
367
+ } else {
368
+ table := tablewriter .NewWriter (os .Stdout )
369
+ table .SetHeader ([]string {"Prefix" , "Count" })
370
+ table .SetBorders (tablewriter.Border {Left : false , Top : false , Right : false , Bottom : false })
371
+
372
+ if * userCountSubprefixes {
373
+ for _ , el := range ei .N (res ).SliceZ () {
374
+ table .Append ([]string {ei .N (el ).M ("prefix" ).StringZ (), fmt .Sprintf ("%d" , ei .N (el ).M ("count" ).IntZ ())})
375
+ }
376
+ } else {
377
+ table .Append ([]string {* userCountPrefix , fmt .Sprintf ("%d" , ei .N (res ).M ("count" ).IntZ ())})
378
+ }
379
+
380
+ table .Render ()
381
+ }
382
+
343
383
case userPass .FullCommand ():
344
384
if _ , err := nc .UserSetPass (* userPassName , * userPassPass ); err != nil {
345
385
log .Println (err )
@@ -423,6 +463,26 @@ func execCmd(nc *nexus.NexusConn, parsed string) {
423
463
424
464
}
425
465
466
+ case sessionsCount .FullCommand ():
467
+ if res , err := nc .SessionCount (* sessionsCountPrefix , & nexus.CountOpts {Subprefixes : * sessionsCountSubprefixes , Filter : * sessionsCountFilter }); err != nil {
468
+ log .Println (err )
469
+ return
470
+ } else {
471
+ table := tablewriter .NewWriter (os .Stdout )
472
+ table .SetHeader ([]string {"Prefix" , "Count" })
473
+ table .SetBorders (tablewriter.Border {Left : false , Top : false , Right : false , Bottom : false })
474
+
475
+ if * sessionsCountSubprefixes {
476
+ for _ , el := range ei .N (res ).SliceZ () {
477
+ table .Append ([]string {ei .N (el ).M ("prefix" ).StringZ (), fmt .Sprintf ("%d" , ei .N (el ).M ("count" ).IntZ ())})
478
+ }
479
+ } else {
480
+ table .Append ([]string {* sessionsCountPrefix , fmt .Sprintf ("%d" , ei .N (res ).M ("count" ).IntZ ())})
481
+ }
482
+
483
+ table .Render ()
484
+ }
485
+
426
486
case sessionsKick .FullCommand ():
427
487
if res , err := nc .SessionKick (* sessionsKickConn ); err != nil {
428
488
log .Println (err )
@@ -684,6 +744,26 @@ func execCmd(nc *nexus.NexusConn, parsed string) {
684
744
685
745
}
686
746
747
+ case chanCount .FullCommand ():
748
+ if res , err := nc .TopicCount (* chanCountPrefix , & nexus.CountOpts {Subprefixes : * chanCountSubprefixes , Filter : * chanCountFilter }); err != nil {
749
+ log .Println (err )
750
+ return
751
+ } else {
752
+ table := tablewriter .NewWriter (os .Stdout )
753
+ table .SetHeader ([]string {"Prefix" , "Count" })
754
+ table .SetBorders (tablewriter.Border {Left : false , Top : false , Right : false , Bottom : false })
755
+
756
+ if * chanCountSubprefixes {
757
+ for _ , el := range ei .N (res ).SliceZ () {
758
+ table .Append ([]string {ei .N (el ).M ("prefix" ).StringZ (), fmt .Sprintf ("%d" , ei .N (el ).M ("count" ).IntZ ())})
759
+ }
760
+ } else {
761
+ table .Append ([]string {* chanCountPrefix , fmt .Sprintf ("%d" , ei .N (res ).M ("count" ).IntZ ())})
762
+ }
763
+
764
+ table .Render ()
765
+ }
766
+
687
767
case syncLock .FullCommand ():
688
768
if res , err := nc .Lock (* syncLockName ); err != nil {
689
769
log .Println (err )
@@ -710,14 +790,33 @@ func execCmd(nc *nexus.NexusConn, parsed string) {
710
790
table .SetBorders (tablewriter.Border {Left : false , Top : false , Right : false , Bottom : false })
711
791
for _ , lock := range res {
712
792
table .Append ([]string {lock .Id , lock .Owner })
713
-
714
793
}
715
794
716
795
table .Render () // Send output
717
796
fmt .Println ()
718
797
719
798
}
720
799
800
+ case syncCount .FullCommand ():
801
+ if res , err := nc .LockCount (* syncCountPrefix , & nexus.CountOpts {Subprefixes : * syncCountSubprefixes , Filter : * syncCountFilter }); err != nil {
802
+ log .Println (err )
803
+ return
804
+ } else {
805
+ table := tablewriter .NewWriter (os .Stdout )
806
+ table .SetHeader ([]string {"Prefix" , "Count" })
807
+ table .SetBorders (tablewriter.Border {Left : false , Top : false , Right : false , Bottom : false })
808
+
809
+ if * syncCountSubprefixes {
810
+ for _ , el := range ei .N (res ).SliceZ () {
811
+ table .Append ([]string {ei .N (el ).M ("prefix" ).StringZ (), fmt .Sprintf ("%d" , ei .N (el ).M ("count" ).IntZ ())})
812
+ }
813
+ } else {
814
+ table .Append ([]string {* syncCountPrefix , fmt .Sprintf ("%d" , ei .N (res ).M ("count" ).IntZ ())})
815
+ }
816
+
817
+ table .Render ()
818
+ }
819
+
721
820
case chanPubJ .FullCommand ():
722
821
var msg map [string ]interface {}
723
822
if json .Unmarshal ([]byte (* chanPubJMsg ), & msg ) != nil {
0 commit comments