@cto.af/linewrap-cli 2.0.0 → 2.1.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/linewrap.js +7 -3
- package/package.json +5 -12
package/bin/linewrap.js
CHANGED
|
@@ -1,5 +1,4 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
|
-
/* eslint-disable no-console */
|
|
3
2
|
|
|
4
3
|
import {inspect, promisify} from 'util';
|
|
5
4
|
import {LineWrap} from '@cto.af/linewrap';
|
|
@@ -8,6 +7,10 @@ import fs from 'fs';
|
|
|
8
7
|
import os from 'os';
|
|
9
8
|
import {parseArgsWithHelp} from 'minus-h';
|
|
10
9
|
|
|
10
|
+
export const DEFAULTS = {
|
|
11
|
+
width: process.stdout.columns ?? 80,
|
|
12
|
+
};
|
|
13
|
+
|
|
11
14
|
/**
|
|
12
15
|
* @type {Parameters<generateHelp>[0]}
|
|
13
16
|
*/
|
|
@@ -122,7 +125,7 @@ const config = {
|
|
|
122
125
|
width: {
|
|
123
126
|
short: 'w',
|
|
124
127
|
type: 'string',
|
|
125
|
-
default: String(
|
|
128
|
+
default: String(DEFAULTS.width),
|
|
126
129
|
argumentName: 'columns',
|
|
127
130
|
description: 'maximum line length',
|
|
128
131
|
},
|
|
@@ -178,11 +181,12 @@ export async function main(
|
|
|
178
181
|
options,
|
|
179
182
|
process = {exit, stdin, stdout, stderr}
|
|
180
183
|
) {
|
|
184
|
+
config.options.width.default = String(DEFAULTS.width);
|
|
181
185
|
const {values, positionals} = parseArgsWithHelp({
|
|
182
186
|
...config,
|
|
183
187
|
...extraConfig,
|
|
184
188
|
}, {
|
|
185
|
-
width:
|
|
189
|
+
width: DEFAULTS.width,
|
|
186
190
|
...options,
|
|
187
191
|
});
|
|
188
192
|
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@cto.af/linewrap-cli",
|
|
3
|
-
"version": "2.
|
|
3
|
+
"version": "2.1.1",
|
|
4
4
|
"description": "Wrap lines using the Unicode Line Breaking algorithm from UAX #14",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"bin": {
|
|
@@ -8,7 +8,7 @@
|
|
|
8
8
|
},
|
|
9
9
|
"scripts": {
|
|
10
10
|
"test": "c8 mocha",
|
|
11
|
-
"lint": "eslint .
|
|
11
|
+
"lint": "eslint .",
|
|
12
12
|
"build": "npm run lint && npm run test && npm pack --dry-run"
|
|
13
13
|
},
|
|
14
14
|
"keywords": [
|
|
@@ -26,17 +26,10 @@
|
|
|
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": "2.1.3",
|
|
30
|
+
"minus-h": "2.1.0"
|
|
31
31
|
},
|
|
32
|
-
"
|
|
33
|
-
"@cto.af/eslint-config": "3.1.0",
|
|
34
|
-
"@types/node": "20.11.25",
|
|
35
|
-
"c8": "9.1.0",
|
|
36
|
-
"eslint": "8.57.0",
|
|
37
|
-
"mocha": "10.3.0"
|
|
38
|
-
},
|
|
39
|
-
"packageManager": "pnpm@8.15.4",
|
|
32
|
+
"packageManager": "pnpm@9.10.0",
|
|
40
33
|
"engines": {
|
|
41
34
|
"node": ">= 18"
|
|
42
35
|
}
|