autoenv

package
v0.12.3 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Feb 13, 2022 License: MIT Imports: 7 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Sync

func Sync(ctx *context.Context, set FeatureSet)

Sync activates / deactivates the features in the instance of env.Env. When a feature is already active but unknown, it will be ignored completely. When a param changes, the feature is deactivated with the current param then activated with the new param.

Types

type FeatureInfo

type FeatureInfo struct {
	Name  string `json:"name"`
	Param string `json:"param"`
}

FeatureInfo represents a parameterized feature

func NewFeatureInfo

func NewFeatureInfo(name string, param string) *FeatureInfo

NewFeatureInfo returns a FeatureInfo

func (FeatureInfo) String added in v0.10.0

func (f FeatureInfo) String() string

type FeatureSet

type FeatureSet []*FeatureInfo

FeatureSet represents a set of parameterized features

func NewFeatureSet

func NewFeatureSet() FeatureSet

NewFeatureSet returns a FeatureSet

func (FeatureSet) Get added in v0.10.0

func (s FeatureSet) Get(name string) *FeatureInfo

Get returns a new FeatureSet augmented with the featureInfo provided

func (FeatureSet) String added in v0.10.0

func (s FeatureSet) String() string

func (FeatureSet) With

func (s FeatureSet) With(featureInfo *FeatureInfo) FeatureSet

With returns a new FeatureSet augmented with the featureInfo provided

func (FeatureSet) Without

func (s FeatureSet) Without(name string) FeatureSet

Without returns a new FeatureSet augmented with the featureInfo provided

type StateData added in v0.10.0

type StateData struct {
	ProjectSlug string     `json:"project"`
	Features    FeatureSet `json:"features"`
	SavedEnv    savedEnv   `json:"saved_env"`
}

type StateManager added in v0.10.0

type StateManager struct {
	UI *termui.UI
	// contains filtered or unexported fields
}

StateManager remember the current state of the features (whether they are active)

func (*StateManager) ForgetEnv added in v0.10.0

func (s *StateManager) ForgetEnv()

ForgetEnv clears the environment mutations previously recorded in the state

func (*StateManager) GetActiveFeatures added in v0.10.0

func (s *StateManager) GetActiveFeatures() FeatureSet

GetActiveFeatures returns the FeatureSet recorded in the state

func (*StateManager) GetProjectSlug added in v0.10.0

func (s *StateManager) GetProjectSlug() string

GetProjectSlug returns the slug of the project in which DevBuddy was when the state was written

func (*StateManager) RestoreEnv added in v0.10.0

func (s *StateManager) RestoreEnv()

RestoreEnv reverts the environment as recorded in the state

func (*StateManager) SaveEnv added in v0.10.0

func (s *StateManager) SaveEnv()

SaveEnv records the environment mutations in the state

func (*StateManager) SetFeature added in v0.10.0

func (s *StateManager) SetFeature(featureInfo *FeatureInfo)

SetFeature marks a feature as active

func (*StateManager) SetProjectSlug added in v0.10.0

func (s *StateManager) SetProjectSlug(slug string)

SetProjectSlug records the project slug in the state

func (*StateManager) UnsetFeature added in v0.10.0

func (s *StateManager) UnsetFeature(name string)

UnsetFeature marks a feature as inactive

Directories

Path Synopsis

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL