env

package
v1.0.2 Latest Latest
Warning

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

Go to latest
Published: Jul 29, 2025 License: Apache-2.0 Imports: 10 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func ApplyConfig

func ApplyConfig(cfg *config.Config, baseDir string) error

func CleanupOrphanedState

func CleanupOrphanedState() error

func ExecuteOnLeaveHook

func ExecuteOnLeaveHook() error

func ExecuteScript

func ExecuteScript(scriptName, scriptContent string, baseDir string, args ...string) error

func ExportForShell

func ExportForShell(cfg *config.Config, baseDir string, shellType string) string

func GetActiveEnvironmentInfo

func GetActiveEnvironmentInfo() (string, bool)

func HasSavedState

func HasSavedState() bool

func RestoreState

func RestoreState() error

func SaveState

func SaveState(state *State) error

func SaveStateWithHook

func SaveStateWithHook(state *State, directory string, onLeaveHook string) error

Types

type AliasDiff

type AliasDiff struct {
	Name     string
	OldValue string
	NewValue string
	Type     DiffType
}

type ConfigDiff

type ConfigDiff struct {
	Environment []EnvDiff
	Aliases     []AliasDiff
	Scripts     []ScriptDiff
}

func GenerateDiff

func GenerateDiff(cfg *config.Config, baseDir string) (*ConfigDiff, error)

func (*ConfigDiff) Format

func (d *ConfigDiff) Format() string

type DiffType

type DiffType int
const (
	Added DiffType = iota
	Modified
	Removed
	Unchanged
)

type EnvDiff

type EnvDiff struct {
	Key      string
	OldValue string
	NewValue string
	Type     DiffType
}

type ScriptDiff

type ScriptDiff struct {
	Name    string
	Content string
	Type    DiffType
}

type State

type State struct {
	Environment map[string]string `json:"environment"`
	Aliases     map[string]string `json:"aliases"`
	Directory   string            `json:"directory"`
	OnLeaveHook string            `json:"on_leave_hook"`
}

func GetCurrentState

func GetCurrentState() (*State, error)

func LoadSavedState

func LoadSavedState() (*State, error)

Jump to

Keyboard shortcuts

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