adds flag coalescing to argparser

adds handling of inlined args to call tools
fixes terminal layout clearing troubles
This commit is contained in:
2025-04-30 03:06:19 -06:00
parent 65f0b4e0b7
commit 26b7089cc2
5 changed files with 58 additions and 60 deletions

View File

@@ -1,4 +1,5 @@
import { Cursor } from "./cursor.ts";
import { ScrollManager } from "./scrollManager.ts";
import { colorize } from "./style.ts";
import { TerminalBlock, TerminalLayout } from "./TerminalLayout.ts";
@@ -11,11 +12,8 @@ export async function cliPrompt(
await Deno.stdin.setRaw(true);
let cursorVisible = true;
if (!block) {
cursorVisible = Cursor["visible"];
Cursor.show();
}
const cursorVisible = Cursor["visible"];
Cursor.show();
let range: [number, number] = [0, 1];
if (block) {
@@ -54,7 +52,7 @@ export async function cliPrompt(
}
await Deno.stdin.setRaw(false);
if (!block && !cursorVisible) {
if (!cursorVisible) {
Cursor.hide();
}
Deno.stdout.writeSync(encoder.encode("\n"));
@@ -86,10 +84,12 @@ export function cliLog(message: string, block?: TerminalBlock) {
}
if (import.meta.main) {
Cursor.hide();
const layout = new TerminalLayout();
const title = new TerminalBlock();
const block = new TerminalBlock();
block.setPreserveHistory(true);
// ScrollManager.enable(block);
title.setLines(["Hello, World!"]);
title.setFixedHeight(1);
@@ -105,6 +105,7 @@ if (import.meta.main) {
cliLog(`Hello, ${name}!`, block);
const single = await cliConfirm("Are you single?", block);
cliLog(single ? "Do you want to go out with me?" : "Okay", block);
// ScrollManager.enable(block);
const loopingConvo = [
"No response?",
"I guess that's okay",