mirror of
https://github.com/ruvnet/ruflo.git
synced 2026-12-03 22:12:01 +09:00
Merge pull request #4018 (rudycelekli) into batch
This commit is contained in:
commit
e8c48e6402
2 files changed
+12
No files matched your search
@@ -0,0 +1,11 @@
|
||||
import { test } from 'vitest';
|
||||
import assert from 'node:assert/strict';
|
||||
import { OutputFormatter } from '../v3/@claude-flow/cli-core/src/output.ts';
|
||||
test('one to three character columns never overflow their border', () => {
|
||||
const f = new OutputFormatter({ color: false });
|
||||
for (const width of [1, 2, 3, 4]) {
|
||||
const lines = f.table({ columns: [{ key: 'value', header: 'Header', width }], data: [{ value: 'Longer content' }] }).split('\n');
|
||||
for (const line of lines) assert.equal(line.length, lines[0].length);
|
||||
assert.equal(lines[0].length, width + 4);
|
||||
}
|
||||
});
|
||||
@@ -371,6 +371,7 @@ export class OutputFormatter {
|
||||
private truncate(text: string, maxLength: number): string {
|
||||
const stripped = this.stripAnsi(text);
|
||||
if (stripped.length <= maxLength) return text;
|
||||
if (maxLength <= 3) return '.'.repeat(Math.max(0, maxLength));
|
||||
return stripped.slice(0, maxLength - 3) + '...';
|
||||
}
|
||||
|
||||
|
||||
Reference in new issue
Block a user