command-api.d.ts
1 import * as yargs from 'yargs'; 2 import { SdkProvider } from './api/aws-auth'; 3 import { Configuration } from './settings'; 4 /** 5 * Command handlers are supposed to be (args) => void, but ours are actually 6 * (args) => Promise<number>, so we deal with the asyncness by copying the actual 7 * handler object to `args.commandHandler` which will be executed an 'await'ed later on 8 * (instead of awaiting 'main'). 9 * 10 * Also adds exception handling so individual command handlers don't all have to do it. 11 */ 12 /** 13 * The parts of the world that our command functions have access to 14 */ 15 export interface CommandOptions { 16 args: yargs.Arguments; 17 configuration: Configuration; 18 aws: SdkProvider; 19 } 20 /** 21 * This is the type of the *real* async command handlers 22 */ 23 export declare type CommandHandler = (options: CommandOptions) => Promise<number>;