mirror of
https://github.com/wavetermdev/backup.git
synced 2026-08-05 13:57:07 -07:00
zsh fixes (zmodload, k8s, new var type, track zsh prompt) (#473)
* checkpoint. track zmodloads, get the expanded PS1 value, change how we store and deal with 'prompt vars', add commands to track k8s context * fix some warnings, change IsPVar to IsExtVar, checkpoint * parse zmodloads into state * restore zmodloads, be more careful around readonly variable setting to avoid errors
This commit is contained in:
@@ -751,16 +751,17 @@ func FeStateFromShellState(state *packet.ShellState) map[string]string {
|
||||
}
|
||||
rtn := make(map[string]string)
|
||||
rtn["cwd"] = state.Cwd
|
||||
envMap := shellenv.EnvMapFromState(state)
|
||||
if envMap["VIRTUAL_ENV"] != "" {
|
||||
rtn["VIRTUAL_ENV"] = envMap["VIRTUAL_ENV"]
|
||||
declMap := shellenv.DeclMapFromState(state)
|
||||
if decl, ok := declMap["VIRTUAL_ENV"]; ok {
|
||||
rtn["VIRTUAL_ENV"] = decl.UnescapedValue()
|
||||
}
|
||||
if envMap["CONDA_DEFAULT_ENV"] != "" {
|
||||
rtn["CONDA_DEFAULT_ENV"] = envMap["CONDA_DEFAULT_ENV"]
|
||||
if decl, ok := declMap["CONDA_DEFAULT_ENV"]; ok {
|
||||
rtn["CONDA_DEFAULT_ENV"] = decl.UnescapedValue()
|
||||
}
|
||||
for key, val := range envMap {
|
||||
if strings.HasPrefix(key, "PROMPTVAR_") && envMap[key] != "" {
|
||||
rtn[key] = val
|
||||
for _, decl := range declMap {
|
||||
// works for both legacy and new IsExtVar decls
|
||||
if strings.HasPrefix(decl.Name, "PROMPTVAR_") {
|
||||
rtn[decl.Name] = decl.UnescapedValue()
|
||||
}
|
||||
}
|
||||
_, _, err := packet.ParseShellStateVersion(state.Version)
|
||||
|
||||
Reference in New Issue
Block a user