feat: separate plain output flags for stdout and stderr

This commit is contained in:
mitchell 2026-04-17 16:49:45 -04:00
parent 9d599d98bf
commit cdfafc9d5f
2 changed files with 23 additions and 9 deletions

View file

@ -15,7 +15,8 @@ const { values: args, positionals } = parseArgs({
save: { type: "boolean" },
s: { type: "boolean" },
plain: { type: "boolean" },
p: { type: "boolean" },
plainOut: { type: "boolean" },
plainErr: { type: "boolean" },
},
strict: true,
allowPositionals: true,
@ -27,7 +28,8 @@ const configFile = Bun.file(`${home}/.aicl_config.json`);
async function main() {
const newConvo = args.new ?? args.n;
const plain = args.plain ?? args.p ?? !process.stdout.isTTY;
const plainOut = args.plainOut ?? args.plain ?? !process.stdout.isTTY;
const plainErr = args.plainErr ?? args.plain ?? !process.stderr.isTTY;
let saveConfig = args.save ?? args.s;
let config: { model?: string };
@ -47,9 +49,10 @@ async function main() {
if (saveConfig) {
await configFile.write(JSON.stringify(config, null, " "));
return;
}
const renderer = new Renderer(plain);
const renderer = new Renderer(plainOut, plainErr);
const provider = createOpenAICompatible({
name: "llama.cpp",
@ -88,7 +91,7 @@ async function main() {
convo.messages.push({ role: "assistant", content: await text });
await convoFile.write(JSON.stringify(convo));
if (!plain) {
if (!plainOut) {
const [width] = process.stdout.getWindowSize();
await Bun.spawn({
cmd: ["glow", "-w", `${width}`, "-"],