dbcat 0.0.14 → 0.0.16

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (2) hide show
  1. package/package.json +2 -2
  2. package/src/table.ts +5 -1
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "dbcat",
3
- "version": "0.0.14",
3
+ "version": "0.0.16",
4
4
  "description": "A simple CLI to view database tables. Supports PostgreSQL, MySQL, and SQLite.",
5
5
  "author": "RiskyMH",
6
6
  "license": "MIT",
@@ -32,7 +32,7 @@
32
32
  "src/*"
33
33
  ],
34
34
  "devDependencies": {
35
- "@types/bun": "latest",
35
+ "@types/bun": "npm:bun-types@canary",
36
36
  "typescript": "^5"
37
37
  }
38
38
  }
package/src/table.ts CHANGED
@@ -77,8 +77,12 @@ export interface TableOptions {
77
77
  fullContent?: boolean;
78
78
  }
79
79
 
80
+ // Wraps a string for table display, preserving ANSI codes and Unicode widths.
80
81
  function wrapLines(str: string, maxWidth: number): string[] {
81
- // Split input into logical words, wrap to fit maxWidth
82
+ if (typeof Bun.wrapAnsi === "function") {
83
+ return Bun.wrapAnsi(str, maxWidth, { hard: true, trim: false }).split("\n");
84
+ }
85
+
82
86
  const raw = str.split(/\n/g).join(" ");
83
87
  if (raw === "") return [""];
84
88