github.com/ActiveState/cli@v0.0.0-20240508170324-6801f60cd051/internal/osutils/autostart/autostart.go (about)

     1  package autostart
     2  
     3  import (
     4  	"github.com/ActiveState/cli/internal/constants"
     5  	configMediator "github.com/ActiveState/cli/internal/mediators/config"
     6  )
     7  
     8  func init() {
     9  	configMediator.RegisterOption(constants.AutostartSvcConfigKey, configMediator.Bool, true)
    10  }
    11  
    12  type Options struct {
    13  	Name           string
    14  	Args           []string
    15  	LaunchFileName string
    16  	IconFileName   string
    17  	IconFileSource string
    18  	GenericName    string
    19  	Comment        string
    20  	Keywords       string
    21  	MacLabel       string // macOS plist Label
    22  	MacInteractive bool   // macOS plist Interactive ProcessType
    23  }
    24  
    25  func Enable(exec string, opts Options) error {
    26  	return enable(exec, opts)
    27  }
    28  
    29  func Disable(exec string, opts Options) error {
    30  	return disable(exec, opts)
    31  }
    32  
    33  // IsEnabled is provided for testing only.
    34  func IsEnabled(exec string, opts Options) (bool, error) {
    35  	return isEnabled(exec, opts)
    36  }
    37  
    38  func AutostartPath(exec string, opts Options) (string, error) {
    39  	return autostartPath(exec, opts)
    40  }
    41  
    42  func Upgrade(exec string, opts Options) error {
    43  	return upgrade(exec, opts)
    44  }