github.com/snyk/vervet/v6@v6.2.4/internal/cmd/context.go (about)

     1  package cmd
     2  
     3  import (
     4  	"context"
     5  	"errors"
     6  )
     7  
     8  func appFromContext(ctx context.Context) (*VervetApp, error) {
     9  	v, ok := ctx.Value(vervetKey).(*VervetApp)
    10  	if !ok {
    11  		return nil, errors.New("could not retrieve vervet app from context")
    12  	}
    13  	return v, nil
    14  }