Versions 163 to 318
Lines 28–34 at 318 (were 28–33 at 163)
2828import { byWhom } from "./history-answers.ts"; 2929import { applyMode, PLAIN, readKnownModes, writeKnownModes } from "./modes.ts"; 3030import { refusedText, screenAnswer } from "./safety.ts"; 31+import { refusalText, withoutArg, withoutHeading } from "./without.ts"; 3233/** The space to read: --draft (where "shared" means shared), else the one this agent is in (shared, in a folder with no agent). */ 3334function space(args: Parsed, agent: string): Where { Lines 426–474 at 318 (were 425–430 at 163)
425426 return { text: lines.join("\n"), json: { ...answer } }; 429+/** abso show <version>[:<file>] --without <versions>: what differs with them left out, or that file then. */ 430+async function showWithout( 436+ leave: readonly number[], 438+ if ("draft" in where && where.draft !== null) throw new UsageError("--without reads shared, not a named draft"); 439+ const colon = word.indexOf(":"); 440+ const v = version(colon >= 0 ? word.slice(0, colon) : word); 441+ const path = colon >= 0 ? fileArg(root, cwd, word.slice(colon + 1)) : undefined; 442+ const answer = await api.without(v, leave); 446+ text: refusalText(answer, (vs) => `abso show ${word} --without ${vs.join(",")}`), 447+ json: { ...answer }, 449+ if (path !== undefined) { 450+ const file = answer.files.find((f) => f.path === path); 451+ if (file === undefined) { 452+ const same = await api.fileAt(path, v, { draft: null }); 453+ if (same.text !== null) return { text: same.text, json: { ...same, without: answer.without } }; 454+ } else if (file.after !== null) return { text: file.after, json: { ...file, without: answer.without } }; 457+ text: `${path} isn't in version ${v} of shared without them.`, 458+ json: { path, version: v, without: answer.without }, 461+ const changed = pairRenames(answer.files); 462+ const d = diffs(changed); 464+ ...withoutHeading(answer), 465+ changed.length === 0 ? `No file differs from version ${v}.` : `Compared with version ${v}: ${totals(changed)}.`, 466+ `The files hash to ${answer.tree}; the same ask gives the same hash. Shared doesn't change.`, 469+ return { text: lines.join("\n"), json: { ...answer, files: d.json } }; 428472export async function runShow(args: Parsed, env: Env): Promise<Output> { 429473 if (args.positionals.length !== 1) 430474 throw new UsageError("show takes one version: abso show <version> or abso show <version>:<file>"); Lines 476–483 at 318 (were 432–437 at 163)
432476 const word = args.positionals[0]!; 433477 const colon = word.indexOf(":"); 434478 const where = space(args, config.agent); 479+ const leave = withoutArg(args); 480+ if (leave !== undefined) return showWithout(api, root, env.cwd, word, where, leave); 437483 const v = version(word.slice(0, colon));