teebot 1.0.0 → 1.0.1
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/bin/teebot.js +11 -3
- package/package.json +1 -1
package/bin/teebot.js
CHANGED
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
|
|
3
3
|
import { execFile } from 'node:child_process'
|
|
4
4
|
|
|
5
|
-
export const VERSION = '1.0.
|
|
5
|
+
export const VERSION = '1.0.1'
|
|
6
6
|
|
|
7
7
|
const VALID_COLORS = ['black', 'white', 'navy', 'grey', 'red', 'asphalt', 'forest', 'gold', 'mauve', 'royal']
|
|
8
8
|
const VALID_FONTS = ['mono', 'sans', 'serif', 'slab', 'hand']
|
|
@@ -51,7 +51,7 @@ export function parseArgs(args) {
|
|
|
51
51
|
if (arg === '--color' && i + 1 < args.length) { result.color = args[++i]; i++; continue }
|
|
52
52
|
if (arg === '--font' && i + 1 < args.length) { result.font = args[++i]; i++; continue }
|
|
53
53
|
if (arg === '--align' && i + 1 < args.length) { result.align = args[++i]; i++; continue }
|
|
54
|
-
if (arg.startsWith('--')) { i++; if (i < args.length && !args[i].startsWith('--')) i++; continue }
|
|
54
|
+
if (arg.startsWith('--') && result.text !== null) { i++; if (i < args.length && !args[i].startsWith('--')) i++; continue }
|
|
55
55
|
if (result.text === null) result.text = arg
|
|
56
56
|
i++
|
|
57
57
|
}
|
|
@@ -85,7 +85,15 @@ export function wrapText(text, maxWidth) {
|
|
|
85
85
|
}
|
|
86
86
|
lines.push(current)
|
|
87
87
|
}
|
|
88
|
-
|
|
88
|
+
// Break lines that exceed maxWidth
|
|
89
|
+
const broken = []
|
|
90
|
+
for (const line of lines) {
|
|
91
|
+
if (line.length <= maxWidth) { broken.push(line); continue }
|
|
92
|
+
for (let i = 0; i < line.length; i += maxWidth) {
|
|
93
|
+
broken.push(line.slice(i, i + maxWidth))
|
|
94
|
+
}
|
|
95
|
+
}
|
|
96
|
+
return broken
|
|
89
97
|
}
|
|
90
98
|
|
|
91
99
|
export function centerPad(text, width) {
|