(svc advancedAppServices, parent commandParent)
| 20 | } |
| 21 | |
| 22 | func (c *commandRepositoryConnect) setup(svc advancedAppServices, parent commandParent) { |
| 23 | cmd := parent.Command("connect", "Connect to a repository.") |
| 24 | |
| 25 | c.co.setup(svc, cmd) |
| 26 | c.server.setup(svc, cmd, &c.co) |
| 27 | |
| 28 | for _, prov := range svc.storageProviders() { |
| 29 | // Set up 'connect' subcommand |
| 30 | f := prov.NewFlags() |
| 31 | cc := cmd.Command(prov.Name, "Connect to repository in "+prov.Description) |
| 32 | f.Setup(svc, cc) |
| 33 | cc.Action(func(kpc *kingpin.ParseContext) error { |
| 34 | return svc.runAppWithContext(kpc.SelectedCommand, func(ctx context.Context) error { |
| 35 | st, err := f.Connect(ctx, false, 0) |
| 36 | if err != nil { |
| 37 | return errors.Wrap(err, "can't connect to storage") |
| 38 | } |
| 39 | |
| 40 | return svc.runConnectCommandWithStorage(ctx, &c.co, st) |
| 41 | }) |
| 42 | }) |
| 43 | } |
| 44 | } |
| 45 | |
| 46 | type connectOptions struct { |
| 47 | connectCacheDirectory string |
nothing calls this directly
no test coverage detected