shell

package
v0.9.1 Latest Latest
Warning

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

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

Documentation

Index

Constants

View Source
const (
	ACK           = 6
	TAB           = 9
	LF            = 10
	CR            = 13
	US            = 31
	SPACE         = 32
	AMPERSTAND    = 38
	SINGLE_QUOTE  = 39
	PLUS          = 43
	NINE          = 57
	QUESTION      = 63
	UPPERCASE_Z   = 90
	OPEN_BRACKET  = 91
	BACKSLASH     = 92
	UNDERSCORE    = 95
	CLOSE_BRACKET = 93
	BACKTICK      = 96
	LOWERCASE_Z   = 122
	TILDA         = 126
	DEL           = 127
)

nolint

Variables

View Source
var Bash = bash{}
View Source
var Clink = clink{}
View Source
var Nushell = nushell{}
View Source
var Zsh = zsh{}

Functions

func BashEscape

func BashEscape(str string) string

https://github.com/solidsnack/shell-escape/blob/master/Text/ShellEscape/Bash.hs

A Bash escaped string. The strings are wrapped in @$\'...\'@ if any bytes within them must be escaped; otherwise, they are left as is. Newlines and other control characters are represented as ANSI escape sequences. High bytes are represented as hex codes. Thus Bash escaped strings will always fit on one line and never contain non-ASCII bytes.

func Open added in v0.6.6

func Open(pid int) error

func PowerShellEscape

func PowerShellEscape(str string) string

Types

type ActivateConfig added in v0.6.1

type ActivateConfig struct {
	SelfPath string
	Args     []string
}

type Shell

type Shell interface {
	// Activate generates a shell script to be placed in the shell's configuration file, which will set up initial
	// environment variables and set a hook to update the environment variables when needed.
	Activate(config ActivateConfig) (string, error)

	// Export generates a string that can be used by the shell to set or unset the given environment variables. (The
	// input specifies environment variables to be unset by giving them a nil value.)
	Export(envs env.Vars) string
}
var Fish Shell = fish{}

Fish adds support for the fish shell as a host

var Pwsh Shell = pwsh{}

Pwsh shell instance

func NewShell

func NewShell(name string) Shell

Jump to

Keyboard shortcuts

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