A Docker-like CLI and HTTP API for managing headless VMs

Merge pull request #10 from tsirysndr/fix/ellipsis

fix: add ellipsis function to truncate long strings in VM table display

authored by tsiry-sandratraina.com and committed by

GitHub ddbde2b5 2931f81a

+4 -1
+4 -1
src/subcommands/ps.ts
··· 42 42 ]), 43 43 ); 44 44 45 + const ellipsis = (str: string, maxLength: number) => 46 + str.length > maxLength ? `${str.slice(0, maxLength - 3)}...` : str; 47 + 45 48 const populateTable = (table: Table, vms: VirtualMachine[]) => 46 49 Effect.sync(() => { 47 50 for (const vm of vms) { ··· 51 54 vm.memory, 52 55 formatStatus(vm), 53 56 vm.pid?.toString() ?? "-", 54 - basename(vm.drivePath || vm.isoPath || "-"), 57 + ellipsis(basename(vm.drivePath || vm.isoPath || "-"), 20), 55 58 vm.bridge ?? "-", 56 59 formatPorts(vm.portForward), 57 60 dayjs.utc(vm.createdAt).local().fromNow(),