UNPKG

nope-js-browser

Version:

NoPE Runtime for the Browser. For nodejs please use nope-js-node

37 lines (36 loc) 1.05 kB
/** * A simple choice. */ export interface IChoice { type: "item"; name: string; value: string; onSelect(): Promise<void>; } /** * A More complex type, which might be rendered. */ export interface ICliMenu { type: "menu"; name: string; value: string; items: TMenuDefinition; preventBack?: true; } export type TMenuDefinition = Array<IChoice | ICliMenu>; /** * Helper to create an interactive menu using Inquirer. * Therefore definition of the menu is required. Once, * a choice is selected -> the provided callback is called. * * Normally, in the menu, a 'back' item is added to go back * to the upper menu. Additionally the user gets an 'exit' * option to leave the app. * * @param menu The menu which should be rendered * @param options Options to control the behavior of the exit-entry etc. */ export declare function createInteractiveMenu(menu: TMenuDefinition, options?: { addExit?: boolean; exitCallback?: () => Promise<void>; }): Promise<void>;