shellhook

package module
v0.1.6 Latest Latest
Warning

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

Go to latest
Published: Dec 9, 2023 License: MIT Imports: 5 Imported by: 0

README

go-shellhook

shell hook library for go programs inspired by direnv

usage

get the latest version

go get -u github.com/patrickhuber/go-shellhook

For a full example see the example

note

This library executes in the shell prompt and does an export of variables in the current shell session. These shell variables will persist between commands.

Documentation

Index

Constants

View Source
const (
	Bash = "bash"
)
View Source
const (
	Powershell = "powershell"
)

Variables

This section is empty.

Functions

func Hook

func Hook(shell Shell, metadata *Metadata) (string, error)

Types

type Exporter added in v0.1.4

type Exporter interface {
	Export(vars map[string]string) string
}

type Hooker added in v0.1.4

type Hooker interface {
	Hook() (string, error)
}

type Metadata

type Metadata struct {
	// the path to the executable
	Executable string

	// the name of the hook
	Name string

	// the args to pass
	Args []string
}

type Namer added in v0.1.4

type Namer interface {
	Name() string
}

type Shell

type Shell interface {
	Namer
	Exporter
	Hooker
	Unsetter
}

func NewBash

func NewBash() Shell

func NewPowershell

func NewPowershell() Shell

type Unsetter added in v0.1.6

type Unsetter interface {
	Unset(vars []string) string
}

Directories

Path Synopsis
cmd

Jump to

Keyboard shortcuts

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