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

Function buildInstallCommand

npm_modules/cli/src/utils/linuxDistro.ts:238–247  ·  view source on GitHub ↗
(packages: string[], distro = detectLinuxDistro())

Source from the content-addressed store, hash-verified

236 * Builds an install command for packages on the current distribution
237 */
238export function buildInstallCommand(packages: string[], distro = detectLinuxDistro()): string {
239 if (distro.type === LinuxDistroType.UNKNOWN) {
240 return `# Unable to determine package manager. Please install manually: ${packages.join(', ')}`;
241 }
242
243 const { packageManager } = distro;
244 const sudo = packageManager.requiresSudo ? 'sudo ' : '';
245
246 return `${sudo}${packageManager.installCommand} ${packages.join(' ')}`;
247}
248
249/**
250 * Gets the package name mappings for common dependencies

Callers 4

getJavaInstallCommandMethod · 0.90
linuxSetupFunction · 0.90

Calls 2

detectLinuxDistroFunction · 0.85
joinMethod · 0.45

Tested by

no test coverage detected