MCPcopy Create free account
hub / github.com/Noumena-Network/code / exitWithMessage

Function exitWithMessage

src/interactiveHelpers.tsx:69–83  ·  view source on GitHub ↗
(root: Root, message: string, options?: {
  color?: TextProps['color'];
  exitCode?: number;
  beforeExit?: () => Promise<void>;
})

Source from the content-addressed store, hash-verified

67 * through the React tree instead.
68 */
69export 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.

Callers 2

exitWithErrorFunction · 0.85
runFunction · 0.85

Calls 3

gracefulShutdownSyncFunction · 0.85
unmountMethod · 0.80
renderMethod · 0.45

Tested by

no test coverage detected