shell

package
v0.2.0 Latest Latest
Warning

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

Go to latest
Published: Apr 18, 2024 License: MIT Imports: 8 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func GenerateScripts

func GenerateScripts(sg ScriptGenerator, env *Environment) error

func UpdateStatus

func UpdateStatus(newEnv *Environment)

Types

type EnvStatus

type EnvStatus struct {
	Added    []string
	Replaced []string
}

type Environment

type Environment struct {
	LoadedFrom string
	Variables  map[string]ReplaceValue
}

func CreateEnvironment

func CreateEnvironment(cfgs []*config.Config) *Environment

type GenerateContext

type GenerateContext struct {
	SessionFolder string
	ShellID       string
	SessionID     string
}

type ReplaceValue

type ReplaceValue struct {
	New string
	Old string
}

type Script

type Script struct {
	Content []byte
}

func (*Script) AddLine

func (s *Script) AddLine(line []byte)

type ScriptGenerator

type ScriptGenerator interface {
	Ctx() GenerateContext
	AddEnvironmentVariable(name string, value string) []byte
	RemoveEnvironmentVariable(name string) []byte
	AddToPath(path string) []byte
	RemoveFromPath(path string) []byte
	SaveScript(script []byte, path string) error
	AppendToScript(script []byte, path string) error
	PrependToScript(script []byte, path string) error
	ScriptExists(path string) bool
	AddComment(comment string)
	ScriptExtension() string

	UnloadEnvironment(env *Environment)
	LoadEnvironment(env *Environment)
	Script() string
}

type Shell added in v0.2.0

type Shell interface {
	ID() string
	Name() string
	SessionFolder() string

	Init() error

	SaveEnvironment(*Environment) error
	LoadEnvironment() *Environment

	ScriptGenerator() ScriptGenerator
}

type Status

type Status struct {
	Env *Environment
}

func CurrentStatus

func CurrentStatus() (*Status, error)

func NewStatusFromEnvironment added in v0.2.0

func NewStatusFromEnvironment(env *Environment) Status

func (Status) Short

func (s Status) Short() string

func (Status) String

func (s Status) String() string

Jump to

Keyboard shortcuts

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