@cto.af/linewrap-cli 2.1.1 → 3.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/README.md +0 -4
- package/bin/linewrap.js +6 -21
- package/package.json +6 -6
package/README.md
CHANGED
|
@@ -50,10 +50,6 @@ Options:
|
|
|
50
50
|
will be inserted before each line Default: " "
|
|
51
51
|
--indentEmpty if the input string is empty, should we still
|
|
52
52
|
indent? Default: false
|
|
53
|
-
--isNewline <regex> a regular expression to replace newlines in the
|
|
54
|
-
input. Empty to leave newlines in place.
|
|
55
|
-
Default: "[^\\S\\r\\n\\v\\f\\x85\\u2028\
|
|
56
|
-
\u2029]*[\\r\\n\\v\\f\\x85\\u2028\\u2029]+\\s*"
|
|
57
53
|
-l,--locale <iso location> locale for grapheme segmentation. Has very
|
|
58
54
|
little effect at the moment
|
|
59
55
|
--newline <string> how to separate the lines of output Default:
|
package/bin/linewrap.js
CHANGED
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
2
|
|
|
3
|
-
import {inspect, promisify} from 'util';
|
|
3
|
+
import {inspect, promisify} from 'node:util';
|
|
4
4
|
import {LineWrap} from '@cto.af/linewrap';
|
|
5
|
-
import {fileURLToPath} from 'url';
|
|
6
|
-
import fs from 'fs';
|
|
7
|
-
import os from 'os';
|
|
5
|
+
import {fileURLToPath} from 'node:url';
|
|
6
|
+
import fs from 'node:fs';
|
|
7
|
+
import os from 'node:os';
|
|
8
8
|
import {parseArgsWithHelp} from 'minus-h';
|
|
9
9
|
|
|
10
10
|
export const DEFAULTS = {
|
|
@@ -30,11 +30,6 @@ const config = {
|
|
|
30
30
|
argumentName: 'string',
|
|
31
31
|
description: 'What string to use when a word is longer than the max width, and in overflow mode "clip"',
|
|
32
32
|
},
|
|
33
|
-
example7: {
|
|
34
|
-
short: '7',
|
|
35
|
-
type: 'boolean',
|
|
36
|
-
description: 'turn on the extra rules from Example 7 of UAX #14',
|
|
37
|
-
},
|
|
38
33
|
firstCol: {
|
|
39
34
|
short: 'c',
|
|
40
35
|
type: 'string',
|
|
@@ -66,12 +61,6 @@ const config = {
|
|
|
66
61
|
default: LineWrap.DEFAULT_OPTIONS.indentEmpty,
|
|
67
62
|
description: 'if the input string is empty, should we still indent?',
|
|
68
63
|
},
|
|
69
|
-
isNewline: {
|
|
70
|
-
type: 'string',
|
|
71
|
-
default: LineWrap.DEFAULT_OPTIONS.isNewline.source,
|
|
72
|
-
argumentName: 'regex',
|
|
73
|
-
description: 'a regular expression to replace newlines in the input. Empty to leave newlines in place.',
|
|
74
|
-
},
|
|
75
64
|
locale: {
|
|
76
65
|
short: 'l',
|
|
77
66
|
type: 'string',
|
|
@@ -210,7 +199,6 @@ export async function main(
|
|
|
210
199
|
const opts = {
|
|
211
200
|
escape: values.html ? htmlEscape : s => s,
|
|
212
201
|
ellipsis: values.ellipsis,
|
|
213
|
-
example7: Boolean(values.example7),
|
|
214
202
|
firstCol: parseInt(values.firstCol, 10),
|
|
215
203
|
hyphen: values.hyphen,
|
|
216
204
|
indent: parseInt(values.indent, 10) || values.indent,
|
|
@@ -225,11 +213,7 @@ export async function main(
|
|
|
225
213
|
verbose: values.verbose,
|
|
226
214
|
width: parseInt(values.width, 10),
|
|
227
215
|
};
|
|
228
|
-
|
|
229
|
-
opts.isNewline = (values.isNewline.length === 0) ?
|
|
230
|
-
null :
|
|
231
|
-
new RegExp(values.isNewline, 'gu');
|
|
232
|
-
}
|
|
216
|
+
|
|
233
217
|
if (values.verbose) {
|
|
234
218
|
process.stdout.write(inspect(opts));
|
|
235
219
|
}
|
|
@@ -256,6 +240,7 @@ export async function main(
|
|
|
256
240
|
|
|
257
241
|
if (fileURLToPath(import.meta.url) === process.argv[1]) {
|
|
258
242
|
main().catch(e => {
|
|
243
|
+
// eslint-disable-next-line no-console
|
|
259
244
|
console.error(e);
|
|
260
245
|
process.exit(1);
|
|
261
246
|
});
|
package/package.json
CHANGED
|
@@ -1,13 +1,13 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@cto.af/linewrap-cli",
|
|
3
|
-
"version": "
|
|
3
|
+
"version": "3.0.1",
|
|
4
4
|
"description": "Wrap lines using the Unicode Line Breaking algorithm from UAX #14",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"bin": {
|
|
7
7
|
"linewrap": "bin/linewrap.js"
|
|
8
8
|
},
|
|
9
9
|
"scripts": {
|
|
10
|
-
"test": "c8
|
|
10
|
+
"test": "c8 node --test test/*.test.js",
|
|
11
11
|
"lint": "eslint .",
|
|
12
12
|
"build": "npm run lint && npm run test && npm pack --dry-run"
|
|
13
13
|
},
|
|
@@ -26,11 +26,11 @@
|
|
|
26
26
|
"license": "MIT",
|
|
27
27
|
"repository": "cto-af/linewrap-cli",
|
|
28
28
|
"dependencies": {
|
|
29
|
-
"@cto.af/linewrap": "2.
|
|
30
|
-
"minus-h": "
|
|
29
|
+
"@cto.af/linewrap": "3.2.0",
|
|
30
|
+
"minus-h": "3.0.0"
|
|
31
31
|
},
|
|
32
|
-
"packageManager": "pnpm@
|
|
32
|
+
"packageManager": "pnpm@10.12.1",
|
|
33
33
|
"engines": {
|
|
34
|
-
"node": ">=
|
|
34
|
+
"node": ">=20"
|
|
35
35
|
}
|
|
36
36
|
}
|