backend

package
v0.0.0-...-bc1aeed Latest Latest
Warning

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

Go to latest
Published: Nov 23, 2024 License: MIT Imports: 14 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var Marshal = func(v interface{}) (io.Reader, error) {
	b, err := json.MarshalIndent(v, "", "\t")
	if err != nil {
		return nil, err
	}
	return bytes.NewReader(b), nil
}

Marshal is a function that marshals the object into an io.Reader. By default, it uses the JSON marshaller.

View Source
var Unmarshal = func(r io.Reader, v interface{}) error {
	return json.NewDecoder(r).Decode(v)
}

Unmarshal is a function that unmarshals the data from the reader into the specified value. By default, it uses the JSON unmarshaller.

Functions

func DeleteChainConfig

func DeleteChainConfig(name string)

func DeleteFile

func DeleteFile(path string) error

func Load

func Load(path string, v interface{}) error

Load loads the file at path into v. Use os.IsNotExist() to see if the returned error is due to the file being missing.

func PrintStructure

func PrintStructure(path string)

func ReadStdin

func ReadStdin() []byte

func ResolvePath

func ResolvePath(path string) string

func RunLauncherCommand

func RunLauncherCommand(commandInput string)

func Save

func Save(path string, v interface{}) error

Save saves a representation of v to the file at path.

func SetDefaults

func SetDefaults()

Types

type Chain

type Chain []Script

func AddChainToChain

func AddChainToChain(chainToAdd Chain, chain Chain) Chain

func AddScriptToChain

func AddScriptToChain(scriptToAdd Script, chain Chain) Chain

func ClearAutoSave

func ClearAutoSave() Chain

func LoadCustomChain

func LoadCustomChain(path string, name string) Chain

func MaybeAutoSaveChain

func MaybeAutoSaveChain(chain Chain) Chain

func ReadChainConfig

func ReadChainConfig() Chain

func RemoveScriptFromChain

func RemoveScriptFromChain(scriptToRemove Script, chain Chain) Chain

func SaveCustomChain

func SaveCustomChain(chain Chain, path string, name string) Chain

type ChainItem

type ChainItem struct {
	Name  string
	Chain Chain
}

func GetChainStructure

func GetChainStructure(path string) []ChainItem

type ChainResult

type ChainResult []ScriptResult

func RunChain

func RunChain(stdin []byte, chain Chain) ChainResult

type Script

type Script struct {
	Name    string
	Command string
	Args    []string
}

func AddArgsToScript

func AddArgsToScript(script Script, argsString string) Script

func GetScriptFromCommand

func GetScriptFromCommand(command string) Script

func GetStructure

func GetStructure(path string) []Script

type ScriptResult

type ScriptResult struct {
	Script Script
	//TODO  use the exit code to determine success
	Success bool
	Stdout  []byte
	Stderr  error
}

func RunKnownScript

func RunKnownScript(command string, stdin []byte) ScriptResult

func RunScript

func RunScript(script Script, stdin []byte) ScriptResult

TODO Maybe create wrappers around these run functions so that tea can run them without halting the UI

Jump to

Keyboard shortcuts

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