shellutil

package
v0.11.0 Latest Latest
Warning

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

Go to latest
Published: Jan 25, 2025 License: Apache-2.0 Imports: 18 Imported by: 0

Documentation

Index

Constants

View Source
const (
	ShellType_bash    = "bash"
	ShellType_zsh     = "zsh"
	ShellType_fish    = "fish"
	ShellType_pwsh    = "pwsh"
	ShellType_unknown = "unknown"
)
View Source
const (
	// there must be no spaces in these integration dir paths
	ZshIntegrationDir  = "shell/zsh"
	BashIntegrationDir = "shell/bash"
	PwshIntegrationDir = "shell/pwsh"
	FishIntegrationDir = "shell/fish"
	WaveHomeBinDir     = "bin"

	ZshStartup_Zprofile = `
# Source the original zprofile
[ -f ~/.zprofile ] && source ~/.zprofile
`

	ZshStartup_Zshrc = `` /* 556-byte string literal not displayed */

	ZshStartup_Zlogin = `` /* 181-byte string literal not displayed */

	ZshStartup_Zshenv = `` /* 372-byte string literal not displayed */

	BashStartup_Bashrc = `` /* 792-byte string literal not displayed */

	FishStartup_Wavefish = `` /* 344-byte string literal not displayed */

	PwshStartup_wavepwsh = `` /* 523-byte string literal not displayed */

)
View Source
const DefaultShellPath = "/bin/bash"
View Source
const DefaultTermCols = 80
View Source
const DefaultTermRows = 24
View Source
const DefaultTermType = "xterm-256color"
View Source
const (
	MaxQuoteSize = 10000000 // 10MB
)

Variables

This section is empty.

Functions

func AddTokenSwapEntry added in v0.11.0

func AddTokenSwapEntry(entry *TokenSwapEntry) error

func DefaultTermSize

func DefaultTermSize() waveobj.TermSize

func DetectLocalShellPath

func DetectLocalShellPath() string

func EncodeEnvVarsForShell added in v0.11.0

func EncodeEnvVarsForShell(shellType string, env map[string]string) (string, error)

func GetEnvStrKey

func GetEnvStrKey(envStr string) string

func GetLocalBashRcFileOverride added in v0.11.0

func GetLocalBashRcFileOverride() string

func GetLocalWaveFishFilePath added in v0.11.0

func GetLocalWaveFishFilePath() string

func GetLocalWavePowershellEnv added in v0.11.0

func GetLocalWavePowershellEnv() string

func GetLocalWshBinaryPath added in v0.11.0

func GetLocalWshBinaryPath(version string, goos string, goarch string) (string, error)

func GetLocalZshZDotDir added in v0.11.0

func GetLocalZshZDotDir() string

func GetMacUserShell

func GetMacUserShell() string

func GetShellTypeFromShellPath added in v0.11.0

func GetShellTypeFromShellPath(shellPath string) string

func HardQuote added in v0.11.0

func HardQuote(s string) string

func HardQuoteFish added in v0.11.0

func HardQuoteFish(s string) string

does not encode newlines or backticks

func HardQuotePowerShell added in v0.11.0

func HardQuotePowerShell(s string) string

func InitCustomShellStartupFiles

func InitCustomShellStartupFiles() error

in a Once block so it can be called multiple times we run it at startup, but also before launching local shells so we know everything is initialized before starting the shell

func InitRcFiles

func InitRcFiles(waveHome string, absWshBinDir string) error

absWshBinDir must be an absolute, expanded path (no ~ or $HOME, etc.) it will be hard-quoted appropriately for the shell

func IsValidEnvVarName added in v0.11.0

func IsValidEnvVarName(name string) bool

func SoftQuote added in v0.11.0

func SoftQuote(s string) string

func UpdateCmdEnv

func UpdateCmdEnv(cmd *exec.Cmd, envVars map[string]string)

func WaveshellLocalEnvVars

func WaveshellLocalEnvVars(termType string) map[string]string

Types

type TokenSwapEntry added in v0.11.0

type TokenSwapEntry struct {
	Token      string             `json:"token"`
	SockName   string             `json:"sockname,omitempty"`
	RpcContext *wshrpc.RpcContext `json:"rpccontext,omitempty"`
	Env        map[string]string  `json:"env,omitempty"`
	ScriptText string             `json:"scripttext,omitempty"`
	Exp        time.Time          `json:"-"`
}

func GetAndRemoveTokenSwapEntry added in v0.11.0

func GetAndRemoveTokenSwapEntry(token string) *TokenSwapEntry

func (*TokenSwapEntry) PackForClient added in v0.11.0

func (t *TokenSwapEntry) PackForClient() (string, error)

type UnpackedTokenType added in v0.11.0

type UnpackedTokenType struct {
	Token      string             `json:"token"` // uuid
	SockName   string             `json:"sockname,omitempty"`
	RpcContext *wshrpc.RpcContext `json:"rpccontext,omitempty"`
}

func UnpackSwapToken added in v0.11.0

func UnpackSwapToken(token string) (*UnpackedTokenType, error)

func (*UnpackedTokenType) Pack added in v0.11.0

func (t *UnpackedTokenType) Pack() (string, error)

Jump to

Keyboard shortcuts

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