UNPKG

@ima/cli

Version:

IMA.js CLI tool to build, develop and work with IMA.js applications.

33 lines (32 loc) 1.34 kB
import { Arguments, CommandBuilder } from 'yargs'; import { HandlerFn, ImaCliCommand } from '../types'; /** * Initializes cli script handler function, which takes cli arguments, * parses them and defines defaults. Should be used to initialize any * cli command script, since it takes care of parsing mandatory arguments. * * @param {HandlerFn} handlerFn Cli script command handler. * @returns {void} */ declare function handlerFactory(handlerFn: HandlerFn): (yargs: Arguments) => Promise<void>; /** * Resolves additional cliArgs that can be provided with custom cli plugins * defined in the ima.config.js. * * @param {ImaCliCommand} Current command for which args are loaded. * @returns {CommandBuilder} Yargs commands object. */ declare function resolveCliPluginArgs(command: ImaCliCommand): CommandBuilder; /** * Initializes shared args with their default values based * on the current CLI command. * * @param {ImaCliCommand} command Current CLI command identifier. * @returns {CommandBuilder} Object with shared args. */ declare function sharedArgsFactory(command: ImaCliCommand): CommandBuilder; /** * Runs a command and waits for it to finish. */ declare function runCommand(command: string, args: string[], env?: {}): Promise<void>; export { handlerFactory, resolveCliPluginArgs, sharedArgsFactory, runCommand };