added super basic cli

This commit is contained in:
2026-02-02 19:25:41 +00:00
parent 5eeb8caa2e
commit b8baafd73a
7 changed files with 415 additions and 0 deletions

31
cli/main.tsx Normal file
View File

@@ -0,0 +1,31 @@
import { createCliRenderer } from "@opentui/core";
import { createRoot, useKeyboard, useTerminalDimensions } from "@opentui/react";
function App() {
const { width, height } = useTerminalDimensions();
useKeyboard((key) => {
if (
key.name === "q" ||
key.name === "escape" ||
(key.ctrl && key.name === "c")
) {
process.exit(0);
}
});
const text = "ob248.com";
const x = Math.floor((width - text.length) / 2);
const y = Math.floor(height / 2);
return (
<box width={width} height={height}>
<text x={x} y={y}>
{text}
</text>
</box>
);
}
const renderer = await createCliRenderer();
createRoot(renderer).render(<App />);