@optique/run 1.3.0-dev.2554 → 1.3.0-dev.2559

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/dist/print.cjs CHANGED
@@ -44,26 +44,13 @@ function printError(message, options = {}) {
44
44
  const output = node_process.default[stream];
45
45
  const quotes = options.quotes ?? !output.isTTY;
46
46
  const colors = options.colors ?? output.isTTY;
47
- const useColors = typeof colors === "object" ? true : colors;
48
- const maxWidth = options.maxWidth ?? output.columns;
49
- const occupied = options.initialWidth ?? 0;
50
- if (!Number.isFinite(occupied) || !Number.isInteger(occupied)) throw new TypeError("Initial width must be a finite integer.");
51
- if (occupied < 0) throw new RangeError("Initial width must be nonnegative.");
52
- const prefix = (0, __optique_core_internal_terminal.placeText)((0, __optique_core_internal_terminal.spaceAfterLabel)((0, __optique_core_internal_terminal.renderTerminalTerm)({
53
- type: "errorLabel",
54
- label: "Error:"
55
- }, options.theme, useColors)), {
56
- line: "",
57
- column: occupied
58
- }, maxWidth);
59
- const formatMessage = (0, __optique_core_internal_terminal.resolveMessageFormatter)(options);
60
- const formatted = formatMessage(message, {
47
+ const formatted = (0, __optique_core_internal_terminal.renderErrorMessage)(message, {
48
+ ...options,
61
49
  colors,
62
50
  quotes,
63
- maxWidth,
64
- initialWidth: prefix.cursor.column
51
+ maxWidth: options.maxWidth ?? output.columns
65
52
  });
66
- output.write(prefix.text + formatted + "\n");
53
+ output.write(formatted + "\n");
67
54
  if (options.exitCode != null) node_process.default.exit(options.exitCode);
68
55
  }
69
56
  /**
package/dist/print.js CHANGED
@@ -1,5 +1,5 @@
1
1
  import process from "node:process";
2
- import { placeText, renderTerminalTerm, resolveMessageFormatter, spaceAfterLabel } from "@optique/core/internal/terminal";
2
+ import { renderErrorMessage, resolveMessageFormatter } from "@optique/core/internal/terminal";
3
3
 
4
4
  //#region src/print.ts
5
5
  /**
@@ -43,26 +43,13 @@ function printError(message, options = {}) {
43
43
  const output = process[stream];
44
44
  const quotes = options.quotes ?? !output.isTTY;
45
45
  const colors = options.colors ?? output.isTTY;
46
- const useColors = typeof colors === "object" ? true : colors;
47
- const maxWidth = options.maxWidth ?? output.columns;
48
- const occupied = options.initialWidth ?? 0;
49
- if (!Number.isFinite(occupied) || !Number.isInteger(occupied)) throw new TypeError("Initial width must be a finite integer.");
50
- if (occupied < 0) throw new RangeError("Initial width must be nonnegative.");
51
- const prefix = placeText(spaceAfterLabel(renderTerminalTerm({
52
- type: "errorLabel",
53
- label: "Error:"
54
- }, options.theme, useColors)), {
55
- line: "",
56
- column: occupied
57
- }, maxWidth);
58
- const formatMessage = resolveMessageFormatter(options);
59
- const formatted = formatMessage(message, {
46
+ const formatted = renderErrorMessage(message, {
47
+ ...options,
60
48
  colors,
61
49
  quotes,
62
- maxWidth,
63
- initialWidth: prefix.cursor.column
50
+ maxWidth: options.maxWidth ?? output.columns
64
51
  });
65
- output.write(prefix.text + formatted + "\n");
52
+ output.write(formatted + "\n");
66
53
  if (options.exitCode != null) process.exit(options.exitCode);
67
54
  }
68
55
  /**
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@optique/run",
3
- "version": "1.3.0-dev.2554",
3
+ "version": "1.3.0-dev.2559",
4
4
  "description": "Type-safe combinatorial command-line interface parser",
5
5
  "keywords": [
6
6
  "CLI",
@@ -76,11 +76,11 @@
76
76
  },
77
77
  "sideEffects": false,
78
78
  "dependencies": {
79
- "@optique/core": "1.3.0-dev.2554+5fdcbbad"
79
+ "@optique/core": "1.3.0-dev.2559+02079a47"
80
80
  },
81
81
  "devDependencies": {
82
- "@optique/config": "1.3.0-dev.2554+5fdcbbad",
83
- "@optique/env": "1.3.0-dev.2554+5fdcbbad",
82
+ "@optique/config": "1.3.0-dev.2559+02079a47",
83
+ "@optique/env": "1.3.0-dev.2559+02079a47",
84
84
  "@types/node": "^24.0.0",
85
85
  "fast-check": "^4.7.0",
86
86
  "tsdown": "^0.13.0",