optimizeit
Version:
OptimizeIt is a command-line tool that automatically optimizes source code for performance and readability, supporting multiple programming languages and configurable settings.
20 lines (19 loc) • 814 B
JavaScript
;
var __importDefault = (this && this.__importDefault) || function (mod) {
return (mod && mod.__esModule) ? mod : { "default": mod };
};
Object.defineProperty(exports, "__esModule", { value: true });
const getFlagValue_1 = __importDefault(require("../helpers/getFlagValue"));
/**
* Handle the API key flag and return the API key.
*
* @param { string[] } args - The arguments passed to the CLI.
* @param { string | undefined } apiKeyConfig - The API key from the config file.
* @returns { string } The API key.
*/
function handleApiKeyFlag(args, apiKeyConfig) {
let apiKey = process.env.GROQ_API_KEY || apiKeyConfig || '';
const apiKeyFromFlag = (0, getFlagValue_1.default)(args, ['-a', '--api-key'], apiKey);
return apiKeyFromFlag || apiKey;
}
exports.default = handleApiKeyFlag;