@giladbarnea/pi-pretty-bash 1.0.9 → 1.0.11
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.
- package/README.md +2 -2
- package/index.ts +7 -3
- package/package.json +4 -3
package/README.md
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
---
|
|
2
|
-
last_updated: 2026-11-
|
|
2
|
+
last_updated: 2026-11-14T11-33
|
|
3
3
|
---
|
|
4
4
|
|
|
5
5
|
<div align="center">
|
|
@@ -27,7 +27,7 @@ Alternatively, install from Git with `pi install git:github.com/giladbarnea/pi-p
|
|
|
27
27
|
|
|
28
28
|
## Rich Bash layout without replacing the Bash tool
|
|
29
29
|
|
|
30
|
-
Dense Bash gets readable spacing and indentation from [shfmt](https://github.com/mvdan/sh), bundled through
|
|
30
|
+
Dense Bash gets readable spacing and indentation from [shfmt](https://github.com/mvdan/sh), bundled through dprint with no system binary needed. Only the display is formatted. Execution and model context keep the original command. Unparseable input stays as written.
|
|
31
31
|
|
|
32
32
|
Short commands get syntax colors in the header. Multiline formatted commands get numbered boxes, and long commands wrap without losing their end. Inputs have a black background; output keeps the terminal background so the two stay distinct. Result boxes show status, elapsed time and line counts. Pi's tool expansion toggle governs both boxes. Collapsed, a command box over ten rows shows its first and last five, and results show ten visual tail rows; expansion shows the complete command and returned text.
|
|
33
33
|
|
package/index.ts
CHANGED
|
@@ -10,7 +10,11 @@ import {
|
|
|
10
10
|
} from "@earendil-works/pi-coding-agent";
|
|
11
11
|
import { truncateToWidth, visibleWidth, wrapTextWithAnsi, type Component } from "@earendil-works/pi-tui";
|
|
12
12
|
import { highlight } from "cli-highlight";
|
|
13
|
-
import {
|
|
13
|
+
import { createFromBuffer } from "@dprint/formatter";
|
|
14
|
+
import { getBuffer } from "@dprint/shfmt";
|
|
15
|
+
|
|
16
|
+
const formatter = createFromBuffer(getBuffer());
|
|
17
|
+
formatter.setConfig({}, { dialect: "bash", useTabs: false, indentWidth: 2, binaryNextLine: true, switchCaseIndent: true, spaceRedirects: true });
|
|
14
18
|
|
|
15
19
|
const JSON_HIGHLIGHT_MAX_BYTES = 200 * 1024;
|
|
16
20
|
const PREVIEW_ROWS = 10;
|
|
@@ -116,9 +120,9 @@ function box(rows: string[], width: number, theme: Theme, caption = ""): string[
|
|
|
116
120
|
*/
|
|
117
121
|
function formatCommand(command: string): string {
|
|
118
122
|
try {
|
|
119
|
-
return
|
|
123
|
+
return formatter.formatText({ filePath: "display.bash", fileText: command }).replace(/\n$/, "");
|
|
120
124
|
} catch (error) {
|
|
121
|
-
if (error instanceof
|
|
125
|
+
if (error instanceof Error && error.constructor === Error) return command;
|
|
122
126
|
throw error;
|
|
123
127
|
}
|
|
124
128
|
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@giladbarnea/pi-pretty-bash",
|
|
3
|
-
"version": "1.0.
|
|
3
|
+
"version": "1.0.11",
|
|
4
4
|
"type": "module",
|
|
5
5
|
"description": "Rich Bash command and result displays with syntax-colored commands and JSON output.",
|
|
6
6
|
"keywords": [
|
|
@@ -46,7 +46,8 @@
|
|
|
46
46
|
"test": "node --test test/*.test.mjs"
|
|
47
47
|
},
|
|
48
48
|
"dependencies": {
|
|
49
|
-
"
|
|
50
|
-
"
|
|
49
|
+
"@dprint/formatter": "0.6.0",
|
|
50
|
+
"@dprint/shfmt": "0.2.0",
|
|
51
|
+
"cli-highlight": "2.1.11"
|
|
51
52
|
}
|
|
52
53
|
}
|