UNPKG

@sap/cli-core

Version:

Command-Line Interface (CLI) Core Module

16 lines (15 loc) 1.18 kB
import { create as createOrHandler } from "../../or.js"; import { create as createNextHandler } from "../../next.js"; import { create as createFailHandler } from "../../fail.js"; import { create as createCheckOptionsExistence } from "../../checkOptionsExistence.js"; import { create as createInputHandler } from "./input.js"; import { create as createFunctionHandler } from "./function.js"; import { create as createSetPasscodeHandler } from "./setPasscode.js"; import { AuthenticationMethod, OPTION_ACCESS_TOKEN, OPTION_CLIENT_ID, OPTION_SECRETS_FILE, } from "../../../../constants.js"; import { getAuthenticationMethods } from "../../../../config/core.js"; export const create = () => { if (getAuthenticationMethods().includes(AuthenticationMethod.passcode)) { return createNextHandler("commands.handler.authentication.passcode", createCheckOptionsExistence(OPTION_CLIENT_ID), createCheckOptionsExistence(OPTION_ACCESS_TOKEN), createCheckOptionsExistence(OPTION_SECRETS_FILE), createOrHandler("commands.handler.authentication.passcode$value", createFunctionHandler(), createInputHandler()), createSetPasscodeHandler()); } return createFailHandler(); };