@twin.org/cli-core 0.0.1-next.3 → 0.0.1-next.7

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.
@@ -472,6 +472,12 @@ class CLIBase {
472
472
  CLIDisplay.header(options.title, options.version, options.icon);
473
473
  }
474
474
  const program = new commander.Command();
475
+ let outputWidth = options.overrideOutputWidth;
476
+ let outputErrWidth = options.overrideOutputWidth;
477
+ if (core.Is.undefined(outputWidth) && process.stdout.isTTY) {
478
+ outputWidth = process.stdout.columns;
479
+ outputErrWidth = process.stderr.columns;
480
+ }
475
481
  program
476
482
  .name(options.appName)
477
483
  .version(options.version)
@@ -480,6 +486,8 @@ class CLIBase {
480
486
  .configureOutput({
481
487
  writeOut: str => CLIDisplay.write(str),
482
488
  writeErr: str => CLIDisplay.writeError(str),
489
+ getOutHelpWidth: () => outputWidth,
490
+ getErrHelpWidth: () => outputErrWidth,
483
491
  outputError: (str, write) => CLIDisplay.error(str.replace(/^error: /, ""), false)
484
492
  })
485
493
  .exitOverride(err => {
@@ -451,6 +451,12 @@ class CLIBase {
451
451
  CLIDisplay.header(options.title, options.version, options.icon);
452
452
  }
453
453
  const program = new Command();
454
+ let outputWidth = options.overrideOutputWidth;
455
+ let outputErrWidth = options.overrideOutputWidth;
456
+ if (Is.undefined(outputWidth) && process.stdout.isTTY) {
457
+ outputWidth = process.stdout.columns;
458
+ outputErrWidth = process.stderr.columns;
459
+ }
454
460
  program
455
461
  .name(options.appName)
456
462
  .version(options.version)
@@ -459,6 +465,8 @@ class CLIBase {
459
465
  .configureOutput({
460
466
  writeOut: str => CLIDisplay.write(str),
461
467
  writeErr: str => CLIDisplay.writeError(str),
468
+ getOutHelpWidth: () => outputWidth,
469
+ getErrHelpWidth: () => outputErrWidth,
462
470
  outputError: (str, write) => CLIDisplay.error(str.replace(/^error: /, ""), false)
463
471
  })
464
472
  .exitOverride(err => {
@@ -26,4 +26,8 @@ export interface ICliOptions {
26
26
  * Supports the loading of env files.
27
27
  */
28
28
  supportsEnvFiles?: boolean;
29
+ /**
30
+ * Override the default output width.
31
+ */
32
+ overrideOutputWidth?: number;
29
33
  }
package/docs/changelog.md CHANGED
@@ -1,5 +1,5 @@
1
1
  # @twin.org/cli-core - Changelog
2
2
 
3
- ## 0.0.1-next.3
3
+ ## 0.0.1-next.7
4
4
 
5
5
  - Initial Release
@@ -49,3 +49,11 @@ Supports different languages.
49
49
  > `optional` **supportsEnvFiles**: `boolean`
50
50
 
51
51
  Supports the loading of env files.
52
+
53
+ ***
54
+
55
+ ### overrideOutputWidth?
56
+
57
+ > `optional` **overrideOutputWidth**: `number`
58
+
59
+ Override the default output width.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@twin.org/cli-core",
3
- "version": "0.0.1-next.3",
3
+ "version": "0.0.1-next.7",
4
4
  "description": "Core classes for building a CLI",
5
5
  "repository": {
6
6
  "type": "git",
@@ -13,42 +13,14 @@
13
13
  "engines": {
14
14
  "node": ">=20.0.0"
15
15
  },
16
- "scripts": {
17
- "clean": "rimraf dist coverage",
18
- "build": "tspc",
19
- "merge-locales": "copyfiles locales/en.json dist",
20
- "test": "vitest --run --config ./vitest.config.ts --no-cache",
21
- "coverage": "vitest --run --coverage --config ./vitest.config.ts --no-cache",
22
- "bundle:esm": "rollup --config rollup.config.mjs --environment MODULE:esm",
23
- "bundle:cjs": "rollup --config rollup.config.mjs --environment MODULE:cjs",
24
- "bundle": "npm run bundle:esm && npm run bundle:cjs",
25
- "docs:clean": "rimraf docs/reference",
26
- "docs:generate": "typedoc",
27
- "docs": "npm run docs:clean && npm run docs:generate",
28
- "dist": "npm run clean && npm run build && npm run merge-locales && npm run test && npm run bundle && npm run docs"
29
- },
30
16
  "dependencies": {
31
- "@twin.org/core": "0.0.1-next.3",
32
- "@twin.org/crypto": "0.0.1-next.3",
17
+ "@twin.org/core": "0.0.1-next.7",
18
+ "@twin.org/crypto": "0.0.1-next.7",
33
19
  "@twin.org/nameof": "next",
34
20
  "chalk": "5.3.0",
35
21
  "commander": "12.1.0",
36
22
  "dotenv": "16.4.5"
37
23
  },
38
- "devDependencies": {
39
- "@twin.org/nameof-transformer": "next",
40
- "@types/node": "22.5.5",
41
- "@vitest/coverage-v8": "2.1.1",
42
- "copyfiles": "2.4.1",
43
- "rimraf": "6.0.1",
44
- "rollup": "4.21.3",
45
- "rollup-plugin-typescript2": "0.36.0",
46
- "ts-patch": "3.2.1",
47
- "typedoc": "0.26.7",
48
- "typedoc-plugin-markdown": "4.2.7",
49
- "typescript": "5.6.2",
50
- "vitest": "2.1.1"
51
- },
52
24
  "main": "./dist/cjs/index.cjs",
53
25
  "module": "./dist/esm/index.mjs",
54
26
  "types": "./dist/types/index.d.ts",