Stack initializes the path stack in the `env` environment. It relies on old state stored in the `originalEnv` environment.
(env, originalEnv map[string]string)
| 32 | // Stack initializes the path stack in the `env` environment. |
| 33 | // It relies on old state stored in the `originalEnv` environment. |
| 34 | func Stack(env, originalEnv map[string]string) *stack { |
| 35 | stackEnv, ok := originalEnv[PathStackEnv] |
| 36 | if !ok || strings.TrimSpace(stackEnv) == "" { |
| 37 | // if path stack is empty, then push the current PATH, which is the |
| 38 | // external environment prior to any devbox-shellenv being applied to it. |
| 39 | stackEnv = InitPathEnv |
| 40 | env[InitPathEnv] = originalEnv["PATH"] |
| 41 | } |
| 42 | return &stack{ |
| 43 | keys: strings.Split(stackEnv, ":"), |
| 44 | } |
| 45 | } |
| 46 | |
| 47 | // String is the value of the stack stored in its env-var. |
| 48 | func (s *stack) String() string { |
no outgoing calls