#!/bin/env -S deno run -A import { crayon } from "https://deno.land/x/crayon@3.3.3/mod.ts"; const [filename] = Deno.args; const args = [filename]; const { stdout } = await new Deno .Command("strings", { args, stdout: "piped" }) .output(); const strings = new TextDecoder().decode(stdout); let passed = false; let rest = strings.split("\n").filter((l) => { if (l === "IDATx") passed = true; return !passed; }).join("\n"); function split_once(text: string, sep: string) { const [first, ...rest] = text.split(sep); return [first, rest.join(sep)]; } let _, prompt, negative, settings; [_, rest] = split_once(rest, "parameters\n"); [prompt, rest] = split_once(rest, "\nNegative prompt: "); [negative, rest] = split_once(rest, "\nSteps: "); [settings, _] = split_once(rest, "\nIDATx"); settings = "Steps: " + settings; const pairs = settings.split(", ").map((p) => split_once(p, ": ")); for (const [key, value] of pairs) { console.log(`${crayon.yellow.bold((key + ":").padEnd(12))} ${value}`); } console.log(`${crayon.yellow.bold("prompt:")} ${prompt} ${crayon.yellow.bold("negative:")} ${negative}`);