diff --git a/src/commands/models/scan.ts b/src/commands/models/scan.ts index fd5b48bbfa2..74b17b8ab86 100644 --- a/src/commands/models/scan.ts +++ b/src/commands/models/scan.ts @@ -10,6 +10,7 @@ import { stylePromptMessage, stylePromptTitle, } from "../../terminal/prompt-style.js"; +import { pad, truncate } from "./list.format.js"; import { formatMs, formatTokenK, updateConfig } from "./shared.js"; const MODEL_PAD = 42; @@ -33,18 +34,6 @@ function guardPromptCancel(value: T | symbol, runtime: RuntimeEnv): T { return value; } -const pad = (value: string, size: number) => value.padEnd(size); - -const truncate = (value: string, max: number) => { - if (value.length <= max) { - return value; - } - if (max <= 3) { - return value.slice(0, max); - } - return `${value.slice(0, max - 3)}...`; -}; - function sortScanResults(results: ModelScanResult[]): ModelScanResult[] { return results.slice().toSorted((a, b) => { const aImage = a.image.ok ? 1 : 0;