UNPKG

@sap/cli-core

Version:

Command-Line Interface (CLI) Core Module

14 lines (13 loc) 608 B
import { get } from "../../../logger/index.js"; import { toConstantCase } from "../../../utils/utils.js"; import { setOption } from "./utils.js"; /* jscpd:ignore-start */ export const create = (option) => async () => async () => { const { debug } = get("commands.handler.options.env"); /* jscpd:ignore-end */ debug(`reading option ${option.longName} from env`); if (!process.env[toConstantCase(option.longName)]) { throw new Error(`env variable process.env.${toConstantCase(option.longName)} is not set`); } setOption(option, process.env[toConstantCase(option.longName)]); };