Starting Over with Ink
This commit is contained in:
44
src/tui-entry.js
Normal file
44
src/tui-entry.js
Normal file
@@ -0,0 +1,44 @@
|
||||
#!/usr/bin/env node
|
||||
|
||||
/**
|
||||
* TUI Entry Point
|
||||
* Initializes the Ink-based Terminal User Interface
|
||||
* Requirements: 2.2, 2.5
|
||||
*/
|
||||
|
||||
const React = require("react");
|
||||
const { render } = require("ink");
|
||||
const TuiApplication = require("./tui/TuiApplication.jsx");
|
||||
|
||||
// Initialize the TUI application
|
||||
const main = () => {
|
||||
try {
|
||||
// Render the main TUI application
|
||||
const { waitUntilExit } = render(React.createElement(TuiApplication));
|
||||
|
||||
// Wait for the application to exit
|
||||
return waitUntilExit();
|
||||
} catch (error) {
|
||||
console.error("Failed to start TUI application:", error);
|
||||
process.exit(1);
|
||||
}
|
||||
};
|
||||
|
||||
// Handle process signals gracefully
|
||||
process.on("SIGINT", () => {
|
||||
process.exit(0);
|
||||
});
|
||||
|
||||
process.on("SIGTERM", () => {
|
||||
process.exit(0);
|
||||
});
|
||||
|
||||
// Start the application
|
||||
if (require.main === module) {
|
||||
main().catch((error) => {
|
||||
console.error("TUI application error:", error);
|
||||
process.exit(1);
|
||||
});
|
||||
}
|
||||
|
||||
module.exports = main;
|
||||
Reference in New Issue
Block a user