{"modulePath":"github.com/wavetermdev/waveterm","version":"v0.14.5","isLatest":true,"isStandardLibrary":false,"goos":"all","goarch":"all","docs":"# package shellutil\n\n## Constants\n\n```go\nconst (\n\tShellType_bash    = \"bash\"\n\tShellType_zsh     = \"zsh\"\n\tShellType_fish    = \"fish\"\n\tShellType_pwsh    = \"pwsh\"\n\tShellType_unknown = \"unknown\"\n)\n```\n\n```go\nconst (\n\t// there must be no spaces in these integration dir paths\n\tZshIntegrationDir  = \"shell/zsh\"\n\tBashIntegrationDir = \"shell/bash\"\n\tPwshIntegrationDir = \"shell/pwsh\"\n\tFishIntegrationDir = \"shell/fish\"\n\tWaveHomeBinDir     = \"bin\"\n\tZshHistoryFileName = \".zsh_history\"\n)\n```\n\n```go\nconst DefaultShellPath = \"/bin/bash\"\n```\n\n```go\nconst DefaultTermCols = 80\n```\n\n```go\nconst DefaultTermRows = 24\n```\n\n```go\nconst DefaultTermType = \"xterm-256color\"\n```\n\n```go\nconst (\n\tMaxQuoteSize = 10000000 // 10MB\n)\n```\n\n## Variables\n\n```go\nvar (\n\t//go:embed shellintegration/zsh_zprofile.sh\n\tZshStartup_Zprofile string\n\n\t//go:embed shellintegration/zsh_zshrc.sh\n\tZshStartup_Zshrc string\n\n\t//go:embed shellintegration/zsh_zlogin.sh\n\tZshStartup_Zlogin string\n\n\t//go:embed shellintegration/zsh_zshenv.sh\n\tZshStartup_Zshenv string\n\n\t//go:embed shellintegration/bash_bashrc.sh\n\tBashStartup_Bashrc string\n\n\t//go:embed shellintegration/bash_preexec.sh\n\tBashStartup_Preexec string\n\n\t//go:embed shellintegration/fish_wavefish.sh\n\tFishStartup_Wavefish string\n\n\t//go:embed shellintegration/pwsh_wavepwsh.sh\n\tPwshStartup_wavepwsh string\n\n\tZshExtendedHistoryPattern = regexp.MustCompile(`^: [0-9]+:`)\n)\n```\n\n## Functions\n\n```go\nfunc AddTokenSwapEntry(entry *TokenSwapEntry) error\n```\n\n```go\nfunc DefaultTermSize() waveobj.TermSize\n```\n\n```go\nfunc DetectLocalShellPath() string\n```\n\n```go\nfunc DetectShellTypeAndVersion() (string, string, error)\n```\n\n```go\nfunc DetectShellTypeAndVersionFromPath(shellPath string) (string, string, error)\n```\n\n```go\nfunc EncodeEnvVarsForShell(shellType string, env map[string]string) (string, error)\n```\n\n```go\nfunc FindGitBash(config *wconfig.FullConfigType, rescan bool) string\n```\n\n```go\nfunc FixupWaveZshHistory() error\n```\n\n```go\nfunc FormatOSC(oscNum int, parts ...string) string\n```\n\n```go\nfunc GetEnvStrKey(envStr string) string\n```\n\n```go\nfunc GetLocalBashRcFileOverride() string\n```\n\n```go\nfunc GetLocalWaveFishFilePath() string\n```\n\n```go\nfunc GetLocalWavePowershellEnv() string\n```\n\n```go\nfunc GetLocalWshBinaryPath(version string, goos string, goarch string) (string, error)\n```\n\n```go\nfunc GetLocalZshZDotDir() string\n```\n\n```go\nfunc GetMacUserShell() string\n```\n\n```go\nfunc GetShellTypeFromShellPath(shellPath string) string\n```\n\n```go\nfunc GetTerminalResetSeq() string\n```\n\n```go\nfunc HardQuote(s string) string\n```\n\n```go\nfunc HardQuoteFish(s string) string\n```\ndoes not encode newlines or backticks\n\n```go\nfunc HardQuotePowerShell(s string) string\n```\n\n```go\nfunc HasWaveZshHistory() (bool, int64)\n```\n\n```go\nfunc InitCustomShellStartupFiles() error\n```\nin 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\n\n```go\nfunc InitRcFiles(waveHome string, absWshBinDir string) error\n```\nabsWshBinDir must be an absolute, expanded path (no ~ or $HOME, etc.) it will be hard-quoted appropriately for the shell\n\n```go\nfunc IsExtendedZshHistoryFile(fileName string) (bool, error)\n```\n\n```go\nfunc IsValidEnvVarName(name string) bool\n```\n\n```go\nfunc SoftQuote(s string) string\n```\n\n```go\nfunc UpdateCmdEnv(cmd *exec.Cmd, envVars map[string]string)\n```\n\n```go\nfunc WaveshellLocalEnvVars(termType string) map[string]string\n```\n\n## Types\n\n```go\ntype TokenSwapEntry struct {\n\tToken      string             `json:\"token\"`\n\tRpcContext *wshrpc.RpcContext `json:\"rpccontext,omitempty\"`\n\tEnv        map[string]string  `json:\"env,omitempty\"`\n\tScriptText string             `json:\"scripttext,omitempty\"`\n\tExp        time.Time          `json:\"-\"`\n}\n```\n\n```go\nfunc GetAndRemoveTokenSwapEntry(token string) *TokenSwapEntry\n```\n\n```go\nfunc (t *TokenSwapEntry) PackForClient() (string, error)\n```\n\n```go\ntype UnpackedTokenType struct {\n\tToken      string             `json:\"token\"` // uuid\n\tRpcContext *wshrpc.RpcContext `json:\"rpccontext,omitempty\"`\n}\n```\n\n```go\nfunc UnpackSwapToken(token string) (*UnpackedTokenType, error)\n```\n\n```go\nfunc (t *UnpackedTokenType) Pack() (string, error)\n```\n\n","path":"github.com/wavetermdev/waveterm/pkg/util/shellutil","name":"shellutil","synopsis":"","isRedistributable":true}
