/// import EventEmitter from "events"; import { render } from "ink"; /** * Launches a CLI app. This is the "bootloader" equivalent for a CLI app. * * If you have any event listeners attached (eg, using `useKeyboard()`, or `useNodeKeypress()`) then * your app won't exit if you don't call `LifecycleHelper.fireExit()`. * * Usage example: * ```tsx * const App:FC = ()=> { * const createShortcutsFn = (): ShortcutToActionMap => * _also( * createNewShortcutToActionMap(), * map => map.set("q", LifecycleHelper.fireExit) * ) * useKeyboardWithMapCached(createShortcutsFn) * return( "Hello" ) * } * * inkCLIAppMainFn( ()=>{ * const args = processCommandLineArgs() * return createInkApp(args) * } ).catch(console.error) * ``` * * @param {() => ReturnType} runFn Do what you need to create an Ink instance * @param okExitMsg If non empty string (truthy) display this on exit w/out errors * @param errExitMsg If non empty string (truthy) display this on exit w/ errors * @return {Promise} Optionally attach a catch block to this promise */ export declare const inkCLIAppMainFn: (runFn: () => ReturnType, okExitMsg?: string, errExitMsg?: string) => Promise; declare type EventName = "exit" | "start"; declare type EventListener = (name: EventName) => void; export declare class LifecycleHelper extends EventEmitter { static instance: LifecycleHelper; static addStartListener: (listener: EventListener) => LifecycleHelper; static addExitListener: (listener: EventListener) => LifecycleHelper; static fireExit: () => boolean; static fireStart: () => boolean; static removeAll: () => LifecycleHelper; } export {};