(svc advancedAppServices, parent commandParent)
| 19 | } |
| 20 | |
| 21 | func (c *commandRepositoryRepair) setup(svc advancedAppServices, parent commandParent) { |
| 22 | cmd := parent.Command("repair", "DEPRECATED: Recover format blob from older-format packs.").Hidden() |
| 23 | |
| 24 | cmd.Flag("recover-format", "Recover format blob from a copy").Default("auto").EnumVar(&c.repairCommandRecoverFormatBlob, "auto", "yes", "no") |
| 25 | cmd.Flag("recover-format-block-prefixes", "Prefixes of file names").StringsVar(&c.repairCommandRecoverFormatBlobPrefixes) |
| 26 | cmd.Flag("dry-run", "Do not modify repository").Short('n').BoolVar(&c.repairDryRun) |
| 27 | |
| 28 | for _, prov := range svc.storageProviders() { |
| 29 | f := prov.NewFlags() |
| 30 | cc := cmd.Command(prov.Name, "Repair repository in "+prov.Description).Hidden() |
| 31 | f.Setup(svc, cc) |
| 32 | cc.Action(func(kpc *kingpin.ParseContext) error { |
| 33 | svc.dangerousCommand() |
| 34 | |
| 35 | return svc.runAppWithContext(kpc.SelectedCommand, func(ctx context.Context) error { |
| 36 | st, err := f.Connect(ctx, false, 0) |
| 37 | if err != nil { |
| 38 | return errors.Wrap(err, "can't connect to storage") |
| 39 | } |
| 40 | |
| 41 | return c.runRepairCommandWithStorage(ctx, st) |
| 42 | }) |
| 43 | }) |
| 44 | } |
| 45 | } |
| 46 | |
| 47 | func packBlockPrefixes() []string { |
| 48 | var str []string |
nothing calls this directly
no test coverage detected