MCPcopy Index your code
hub / github.com/jetify-com/devbox / Stack

Function Stack

internal/devbox/envpath/stack.go:34–45  ·  view source on GitHub ↗

Stack initializes the path stack in the `env` environment. It relies on old state stored in the `originalEnv` environment.

(env, originalEnv map[string]string)

Source from the content-addressed store, hash-verified

32// Stack initializes the path stack in the `env` environment.
33// It relies on old state stored in the `originalEnv` environment.
34func 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.
48func (s *stack) String() string {

Callers 3

computeEnvMethod · 0.92
IsEnvEnabledMethod · 0.92
TestNewStackFunction · 0.85

Calls

no outgoing calls

Tested by 1

TestNewStackFunction · 0.68