UNPKG

shellcheck

Version:

Wrapper to download shellcheck

28 lines (27 loc) 1.34 kB
"use strict"; var __importDefault = (this && this.__importDefault) || function (mod) { return (mod && mod.__esModule) ? mod : { "default": mod }; }; Object.defineProperty(exports, "__esModule", { value: true }); exports.shellCheckArchitecture = void 0; const node_process_1 = __importDefault(require("node:process")); const configs_1 = require("../configs"); const errors_1 = require("../errors"); /** * Convert architecture to ShellCheck architecture. * * @param args - Arguments. * @returns ShellCheck architecture. */ function shellCheckArchitecture(args) { var _a, _b, _c, _d; const opts = { architecture: (_a = args === null || args === void 0 ? void 0 : args.architecture) !== null && _a !== void 0 ? _a : node_process_1.default.arch, platform: (_b = args === null || args === void 0 ? void 0 : args.platform) !== null && _b !== void 0 ? _b : node_process_1.default.platform }; const architecture = (_d = (_c = configs_1.config.binaries[opts.platform]) === null || _c === void 0 ? void 0 : _c.architectures.find((arch) => arch[0] === opts.architecture)) === null || _d === void 0 ? void 0 : _d[1]; if (architecture === undefined) throw new errors_1.ArchitectureError(opts.architecture, opts.platform); return architecture; } exports.shellCheckArchitecture = shellCheckArchitecture;