github.com/ActiveState/cli@v0.0.0-20240508170324-6801f60cd051/pkg/project/events.go (about)

     1  package project
     2  
     3  import (
     4  	"os"
     5  	"strings"
     6  
     7  	"github.com/ActiveState/cli/internal/constants"
     8  )
     9  
    10  type EventType string
    11  
    12  const (
    13  	BeforeCmd     EventType = "before-command"
    14  	AfterCmd      EventType = "after-command"
    15  	Activate      EventType = "activate"
    16  	FirstActivate EventType = "first-activate"
    17  )
    18  
    19  func (e EventType) String() string {
    20  	return string(e)
    21  }
    22  
    23  func ActivateEvents() []EventType {
    24  	if strings.EqualFold(os.Getenv(constants.DisableActivateEventsEnvVarName), "true") {
    25  		return []EventType{}
    26  	}
    27  
    28  	return []EventType{
    29  		Activate,
    30  		FirstActivate,
    31  	}
    32  }