MCPcopy Create free account
hub / github.com/Snapchat/Valdi / getBazelCli

Function getBazelCli

npm_modules/cli/src/utils/BazelClient.ts:18–34  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

16let cached_bazel_executable: string | undefined;
17
18function getBazelCli(): string {
19 if (!cached_bazel_executable) {
20 const bazelBinEnv = process.env[BAZEL_BIN_ENV];
21 if (bazelBinEnv) {
22 cached_bazel_executable = bazelBinEnv;
23 return bazelBinEnv;
24 }
25
26 const found = BAZEL_EXECUTABLES.find(element => checkCommandExists(element));
27 if (!found) {
28 throw new Error('Could not find bazel executable (bzl or bazel)');
29 }
30 cached_bazel_executable = found;
31 }
32
33 return cached_bazel_executable;
34}
35
36function getBazelCommandString(baseCommand: string, extraArgs: string, quiet: boolean): string {
37 return `${getBazelCli()} ${BAZEL_PREFIXED_OPTIONS} ${baseCommand} ${extraArgs} ${quiet ? BAZEL_QUIET_OPTIONS : ''} ${BAZEL_POSTFIXED_OPTIONS}`.trim();

Callers 3

getBazelCommandStringFunction · 0.85
runCommandMethod · 0.85
spawnCommandMethod · 0.85

Calls 2

checkCommandExistsFunction · 0.90
findMethod · 0.45

Tested by

no test coverage detected