MCPcopy Index your code
hub / github.com/devcontainers/cli / substitute

Function substitute

src/spec-common/variableSubstitution.ts:20–34  ·  view source on GitHub ↗
(context: SubstitutionContext, value: T)

Source from the content-addressed store, hash-verified

18}
19
20export function substitute<T extends object>(context: SubstitutionContext, value: T): T {
21 let env: NodeJS.ProcessEnv | undefined;
22 const isWindows = context.platform === 'win32';
23 const updatedContext = {
24 ...context,
25 get env() {
26 return env || (env = normalizeEnv(isWindows, context.env));
27 }
28 };
29 const replace = replaceWithContext.bind(undefined, isWindows, updatedContext);
30 if (context.containerWorkspaceFolder) {
31 updatedContext.containerWorkspaceFolder = resolveString(replace, context.containerWorkspaceFolder);
32 }
33 return substitute0(replace, value);
34}
35
36export function beforeContainerSubstitute<T extends object>(idLabels: Record<string, string> | undefined, value: T): T {
37 let devcontainerId: string | undefined;

Callers 7

doSetUpFunction · 0.90
doRunUserCommandsFunction · 0.90
readConfigurationFunction · 0.90
doExecFunction · 0.90
substitute0Function · 0.90
addSubstitutionFunction · 0.85

Calls 2

resolveStringFunction · 0.85
substitute0Function · 0.70

Tested by

no test coverage detected