(sf *serverClientFlags, act func(ctx context.Context, cli *apiclient.KopiaAPIClient) error)
| 392 | } |
| 393 | |
| 394 | func (c *App) serverAction(sf *serverClientFlags, act func(ctx context.Context, cli *apiclient.KopiaAPIClient) error) func(ctx *kingpin.ParseContext) error { |
| 395 | return func(kpc *kingpin.ParseContext) error { |
| 396 | opts, err := sf.serverAPIClientOptions() |
| 397 | if err != nil { |
| 398 | return errors.Wrap(err, "unable to create API client options") |
| 399 | } |
| 400 | |
| 401 | apiClient, err := apiclient.NewKopiaAPIClient(opts) |
| 402 | if err != nil { |
| 403 | return errors.Wrap(err, "unable to create API client") |
| 404 | } |
| 405 | |
| 406 | return c.runAppWithContext(kpc.SelectedCommand, func(ctx context.Context) error { |
| 407 | return act(ctx, apiClient) |
| 408 | }) |
| 409 | } |
| 410 | } |
| 411 | |
| 412 | func assertDirectRepository(act func(ctx context.Context, rep repo.DirectRepository) error) func(ctx context.Context, rep repo.Repository) error { |
| 413 | return func(ctx context.Context, rep repo.Repository) error { |
nothing calls this directly
no test coverage detected