UNPKG

@sap/cli-core

Version:

Command-Line Interface (CLI) Core Module

23 lines (22 loc) 1.03 kB
import { get as getConfig } from "../../config/index.js"; import { getAuthenticationMethods } from "../../config/core.js"; import { AuthenticationMethod } from "../../constants.js"; import { get as getLogger } from "../../logger/index.js"; import { buildCommand } from "../../utils/commands.js"; import { createNextHandler, createMandatoryOptionsHandler, createParseArgumentsHandler, } from "../handler/index.js"; const passcode = async () => async () => { const { output } = getLogger("commands.passcode"); const config = getConfig(); output(config.passcodeUrl); }; const passcodeCommand = { type: "command", command: "passcode-url", description: "display the passcode url", handler: createNextHandler("commands.config.passcode-url", createParseArgumentsHandler(), createMandatoryOptionsHandler(), passcode), }; export const addCommands = async (program) => { if (getAuthenticationMethods().includes(AuthenticationMethod.passcode)) { await buildCommand(program, passcodeCommand); } };