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

Function getExpressionValue

src/spec-node/dockerfileUtils.ts:149–156  ·  view source on GitHub ↗
(option: string, isSet: boolean, word: string, value: string)

Source from the content-addressed store, hash-verified

147}
148
149function getExpressionValue(option: string, isSet: boolean, word: string, value: string) {
150 const operations: Record<string, Function> = {
151 '-': (isSet: boolean, word: string, value: string) => isSet ? value : word,
152 '+': (isSet: boolean, word: string, value: string) => isSet ? word : value,
153 };
154
155 return operations[option](isSet, word, value).replace(/^['"]|['"]$/g, ''); // remove quotes from start and end of the string
156}
157
158function replaceVariables(dockerfile: Dockerfile, buildArgs: Record<string, string>, baseImageEnv: Record<string, string>, globalBuildxPlatformArgs: Record<string, string> = {}, str: string, stage: { from?: From; instructions: Instruction[] }, beforeInstructionIndex: number) {
159 return [...str.matchAll(argumentExpression)]

Callers 1

replaceVariablesFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected