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