MCPcopy Index your code
hub / github.com/kopia/kopia / runAppWithContext

Method runAppWithContext

cli/app.go:465–500  ·  view source on GitHub ↗
(command *kingpin.CmdClause, cb func(ctx context.Context) error)

Source from the content-addressed store, hash-verified

463}
464
465func (c *App) runAppWithContext(command *kingpin.CmdClause, cb func(ctx context.Context) error) error {
466 ctx := c.rootctx
467
468 if c.loggerFactory != nil {
469 ctx = logging.WithLogger(ctx, c.loggerFactory)
470 }
471
472 for _, r := range c.trackReleasable {
473 releasable.EnableTracking(releasable.ItemKind(r))
474 }
475
476 var spanName string
477
478 if command != nil {
479 spanName = command.FullCommand()
480 }
481
482 err := c.observability.run(ctx, spanName, func(ctx context.Context) error {
483 defer c.runOnExit()
484
485 return cb(ctx)
486 })
487 if err != nil {
488 log(ctx).Errorf("%v", err.Error())
489 c.exitWithError(err)
490 }
491
492 if len(c.trackReleasable) > 0 {
493 if err := releasable.Verify(); err != nil {
494 log(ctx).Warnf("%v", err.Error())
495 c.exitWithError(err)
496 }
497 }
498
499 return nil
500}
501
502type repositoryAccessMode struct {
503 allowMaintenance bool

Callers 4

noRepositoryActionMethod · 0.95
serverActionMethod · 0.95
baseActionWithContextMethod · 0.95
repositoryHintActionMethod · 0.95

Calls 8

runOnExitMethod · 0.95
WithLoggerFunction · 0.92
EnableTrackingFunction · 0.92
ItemKindTypeAlias · 0.92
VerifyFunction · 0.92
ErrorfMethod · 0.80
ErrorMethod · 0.65
runMethod · 0.45

Tested by

no test coverage detected