@optique/run 0.4.0-dev.54 → 0.4.0-dev.55
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/run.cjs +2 -1
- package/dist/run.d.cts +13 -0
- package/dist/run.d.ts +13 -0
- package/dist/run.js +2 -1
- package/package.json +1 -1
package/dist/run.cjs
CHANGED
|
@@ -54,7 +54,7 @@ const node_process = require_rolldown_runtime.__toESM(require("node:process"));
|
|
|
54
54
|
* ```
|
|
55
55
|
*/
|
|
56
56
|
function run(parser, options = {}) {
|
|
57
|
-
const { programName = node_path.default.basename(node_process.default.argv[1] || "cli"), args = node_process.default.argv.slice(2), colors = node_process.default.stdout.isTTY, maxWidth = node_process.default.stdout.columns, help, version, aboveError = "usage", errorExitCode = 1 } = options;
|
|
57
|
+
const { programName = node_path.default.basename(node_process.default.argv[1] || "cli"), args = node_process.default.argv.slice(2), colors = node_process.default.stdout.isTTY, maxWidth = node_process.default.stdout.columns, showDefault, help, version, aboveError = "usage", errorExitCode = 1 } = options;
|
|
58
58
|
const helpConfig = help ? {
|
|
59
59
|
mode: help,
|
|
60
60
|
onShow: () => node_process.default.exit(0)
|
|
@@ -67,6 +67,7 @@ function run(parser, options = {}) {
|
|
|
67
67
|
return (0, __optique_core_facade.run)(parser, programName, args, {
|
|
68
68
|
colors,
|
|
69
69
|
maxWidth,
|
|
70
|
+
showDefault,
|
|
70
71
|
help: helpConfig,
|
|
71
72
|
version: versionConfig,
|
|
72
73
|
aboveError,
|
package/dist/run.d.cts
CHANGED
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import { InferValue, Parser } from "@optique/core/parser";
|
|
2
|
+
import { ShowDefaultOptions } from "@optique/core/doc";
|
|
2
3
|
|
|
3
4
|
//#region src/run.d.ts
|
|
4
5
|
|
|
@@ -31,6 +32,18 @@ interface RunOptions {
|
|
|
31
32
|
* @default `process.stdout.columns` (auto-detect terminal width)
|
|
32
33
|
*/
|
|
33
34
|
readonly maxWidth?: number;
|
|
35
|
+
/**
|
|
36
|
+
* Whether and how to display default values for options and arguments.
|
|
37
|
+
*
|
|
38
|
+
* - `boolean`: When `true`, displays defaults using format `[value]`
|
|
39
|
+
* - `ShowDefaultOptions`: Custom formatting with configurable prefix and suffix
|
|
40
|
+
*
|
|
41
|
+
* Default values are automatically dimmed when `colors` is enabled.
|
|
42
|
+
*
|
|
43
|
+
* @default `false`
|
|
44
|
+
* @since 0.4.0
|
|
45
|
+
*/
|
|
46
|
+
readonly showDefault?: boolean | ShowDefaultOptions;
|
|
34
47
|
/**
|
|
35
48
|
* Help configuration. Determines how help is made available:
|
|
36
49
|
*
|
package/dist/run.d.ts
CHANGED
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import { InferValue, Parser } from "@optique/core/parser";
|
|
2
|
+
import { ShowDefaultOptions } from "@optique/core/doc";
|
|
2
3
|
|
|
3
4
|
//#region src/run.d.ts
|
|
4
5
|
|
|
@@ -31,6 +32,18 @@ interface RunOptions {
|
|
|
31
32
|
* @default `process.stdout.columns` (auto-detect terminal width)
|
|
32
33
|
*/
|
|
33
34
|
readonly maxWidth?: number;
|
|
35
|
+
/**
|
|
36
|
+
* Whether and how to display default values for options and arguments.
|
|
37
|
+
*
|
|
38
|
+
* - `boolean`: When `true`, displays defaults using format `[value]`
|
|
39
|
+
* - `ShowDefaultOptions`: Custom formatting with configurable prefix and suffix
|
|
40
|
+
*
|
|
41
|
+
* Default values are automatically dimmed when `colors` is enabled.
|
|
42
|
+
*
|
|
43
|
+
* @default `false`
|
|
44
|
+
* @since 0.4.0
|
|
45
|
+
*/
|
|
46
|
+
readonly showDefault?: boolean | ShowDefaultOptions;
|
|
34
47
|
/**
|
|
35
48
|
* Help configuration. Determines how help is made available:
|
|
36
49
|
*
|
package/dist/run.js
CHANGED
|
@@ -53,7 +53,7 @@ import process from "node:process";
|
|
|
53
53
|
* ```
|
|
54
54
|
*/
|
|
55
55
|
function run(parser, options = {}) {
|
|
56
|
-
const { programName = path.basename(process.argv[1] || "cli"), args = process.argv.slice(2), colors = process.stdout.isTTY, maxWidth = process.stdout.columns, help, version, aboveError = "usage", errorExitCode = 1 } = options;
|
|
56
|
+
const { programName = path.basename(process.argv[1] || "cli"), args = process.argv.slice(2), colors = process.stdout.isTTY, maxWidth = process.stdout.columns, showDefault, help, version, aboveError = "usage", errorExitCode = 1 } = options;
|
|
57
57
|
const helpConfig = help ? {
|
|
58
58
|
mode: help,
|
|
59
59
|
onShow: () => process.exit(0)
|
|
@@ -66,6 +66,7 @@ function run(parser, options = {}) {
|
|
|
66
66
|
return run$1(parser, programName, args, {
|
|
67
67
|
colors,
|
|
68
68
|
maxWidth,
|
|
69
|
+
showDefault,
|
|
69
70
|
help: helpConfig,
|
|
70
71
|
version: versionConfig,
|
|
71
72
|
aboveError,
|