textui/mod.ts

16 lines
401 B
TypeScript
Raw Normal View History

2021-05-19 13:00:52 +00:00
import { AnsiTerminalDisplay } from "./ansi.ts";
2021-06-24 23:09:05 +00:00
import { TextUI, UIPalette } from "./ui.ts";
2021-05-19 13:00:52 +00:00
export { TextUI } from "./ui.ts";
2021-06-24 23:09:05 +00:00
export type UIConfig = {
palette: UIPalette;
};
export async function createTextUI(config: UIConfig): Promise<TextUI> {
2021-05-19 13:00:52 +00:00
// TODO detect platform
var display = new AnsiTerminalDisplay();
var ui = new TextUI(display);
2021-06-24 23:09:05 +00:00
await ui.init(config.palette);
2021-05-19 13:00:52 +00:00
return ui;
}