UNPKG

@sap/cli-core

Version:

Command-Line Interface (CLI) Core Module

18 lines (17 loc) 762 B
import { OPTION_OPTIONS_FILE } from "../../../constants.js"; import { get } from "../../../logger/index.js"; import { getOptionValueFromConfig } from "../../../utils/options.js"; import { getValueFromOptionsFile, setOption } from "./utils.js"; /* jscpd:ignore-start */ export const create = (option) => async () => async () => { const { debug, trace } = get("commands.handler.options.file"); /* jscpd:ignore-end */ debug(`reading option ${option.longName} from file`); const filePath = getOptionValueFromConfig(OPTION_OPTIONS_FILE); try { setOption(option, await getValueFromOptionsFile(filePath, option)); } catch (err) { trace(`failed to read option ${option.longName} from options file ${filePath}`, err); } };