summary refs log tree commit diff
path: root/main.ts
blob: 4fe68ff23ebcee4a8eb5d560715fd52d8f01a674 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
// deno-lint-ignore-file no-process-globals
import LoginScreen from "./screen/login.ts";
import { build } from "./screenbuilder.ts";
import readline from 'node:readline';
import * as client from "./client.ts"

readline.emitKeypressEvents(process.stdin);

if (process.stdin.isTTY) process.stdin.setRawMode(true); // makes the terminal send stdin without the user pressing enter

let screen;
try {
    screen = build(LoginScreen, client);
    client.setScreen(screen)
} catch (error) {
    console.error(error);
    for (const log of screen?.logs ?? []) {
        console.log(log)
    }
}