UNPKG

shellcheck

Version:

Wrapper to download shellcheck

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