(root: Root, message: string, options?: {
color?: TextProps['color'];
exitCode?: number;
beforeExit?: () => Promise<void>;
})
| 67 | * through the React tree instead. |
| 68 | */ |
| 69 | export async function exitWithMessage(root: Root, message: string, options?: { |
| 70 | color?: TextProps['color']; |
| 71 | exitCode?: number; |
| 72 | beforeExit?: () => Promise<void>; |
| 73 | }): Promise<never> { |
| 74 | const { |
| 75 | Text |
| 76 | } = await import('./ink.js'); |
| 77 | const color = options?.color; |
| 78 | const exitCode = options?.exitCode ?? 1; |
| 79 | root.render(color ? <Text color={color}>{message}</Text> : <Text>{message}</Text>); |
| 80 | root.unmount(); |
| 81 | await options?.beforeExit?.(); |
| 82 | gracefulShutdownSync(exitCode); |
| 83 | } |
| 84 | |
| 85 | /** |
| 86 | * Show a setup dialog wrapped in AppStateProvider + KeybindingSetup. |
no test coverage detected