@@ -101,9 +101,11 @@ func (c *cli) CmdHelp() error {
101
101
{"add" , "Add a new mirror" },
102
102
{"addMetric" , "Add a tracked file to the metrics route" },
103
103
{"disable" , "Disable a mirror" },
104
+ {"disableAuto" , "Disable automatic file tracking" },
104
105
{"delMetric" , "Delete a tracked file from the metrics route" },
105
106
{"edit" , "Edit a mirror" },
106
107
{"enable" , "Enable a mirror" },
108
+ {"enableAuto" , "Enable automatic file tracking" },
107
109
{"export" , "Export the mirror database" },
108
110
{"list" , "List all mirrors" },
109
111
{"listMetrics" , "List all tracked files from the metrics route" },
@@ -114,6 +116,7 @@ func (c *cli) CmdHelp() error {
114
116
{"scan" , "(Re-)Scan a mirror" },
115
117
{"show" , "Print a mirror configuration" },
116
118
{"stats" , "Show download stats" },
119
+ {"statusAuto" , "Show automatic file tracking boolean" },
117
120
{"upgrade" , "Seamless binary upgrade" },
118
121
{"version" , "Print version information" },
119
122
} {
@@ -444,6 +447,69 @@ func (c *cli) CmdListmetrics(args ...string) error {
444
447
return nil
445
448
}
446
449
450
+ func (c * cli ) CmdEnableauto (args ... string ) error {
451
+ cmd := SubCmd ("enableAuto" , "" , "Enable automatic addition of new files to tracked files" )
452
+
453
+ if err := cmd .Parse (args ); err != nil {
454
+ return nil
455
+ }
456
+ if cmd .NArg () != 0 {
457
+ cmd .Usage ()
458
+ return nil
459
+ }
460
+
461
+ client := c .GetRPC ()
462
+ ctx , cancel := context .WithTimeout (context .Background (), defaultRPCTimeout )
463
+ defer cancel ()
464
+ client .EnableAuto (ctx , & empty.Empty {})
465
+
466
+ return nil
467
+ }
468
+
469
+ func (c * cli ) CmdDisableauto (args ... string ) error {
470
+ cmd := SubCmd ("disableAuto" , "" , "Disable automatic addition of new files to tracked files" )
471
+
472
+ if err := cmd .Parse (args ); err != nil {
473
+ return nil
474
+ }
475
+ if cmd .NArg () != 0 {
476
+ cmd .Usage ()
477
+ return nil
478
+ }
479
+
480
+ client := c .GetRPC ()
481
+ ctx , cancel := context .WithTimeout (context .Background (), defaultRPCTimeout )
482
+ defer cancel ()
483
+ client .DisableAuto (ctx , & empty.Empty {})
484
+
485
+ return nil
486
+ }
487
+
488
+ func (c * cli ) CmdStatusauto (args ... string ) error {
489
+ cmd := SubCmd ("statusAuto" , "" , "Print boolean of automatic addition of new files to tracked files" )
490
+
491
+ if err := cmd .Parse (args ); err != nil {
492
+ return nil
493
+ }
494
+ if cmd .NArg () != 0 {
495
+ cmd .Usage ()
496
+ return nil
497
+ }
498
+
499
+ client := c .GetRPC ()
500
+ ctx , cancel := context .WithTimeout (context .Background (), defaultRPCTimeout )
501
+ defer cancel ()
502
+ status , _ := client .GetStatusAuto (ctx , & empty.Empty {})
503
+
504
+ if status .Status {
505
+ log .Info ("Auto tracked files is enabled" )
506
+ } else {
507
+ log .Info ("Auto tracked files is disabled" )
508
+ }
509
+
510
+ return nil
511
+ }
512
+
447
513
func (c * cli ) CmdRemove (args ... string ) error {
448
514
cmd := SubCmd ("remove" , "IDENTIFIER" , "Remove an existing mirror" )
449
515
force := cmd .Bool ("f" , false , "Never prompt for confirmation" )
0 commit comments