@optique/run 0.10.0-dev.360 → 0.10.0-dev.363

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 CHANGED
@@ -42,12 +42,39 @@ function runImpl(parserOrProgram, options = {}) {
42
42
  value: typeof version === "string" ? version : version.value,
43
43
  onShow: () => node_process.default.exit(0)
44
44
  } : void 0;
45
- const completionConfig = completion ? {
46
- mode: typeof completion === "string" ? completion : completion.mode ?? "both",
47
- shells: typeof completion === "string" ? void 0 : completion.shells,
48
- name: typeof completion === "string" ? "both" : completion.name ?? "both",
49
- onShow: () => node_process.default.exit(0)
50
- } : void 0;
45
+ const completionConfig = (() => {
46
+ if (!completion) return void 0;
47
+ if (typeof completion === "string") return {
48
+ mode: completion,
49
+ shells: void 0,
50
+ name: "both",
51
+ helpVisibility: "both",
52
+ onShow: () => node_process.default.exit(0)
53
+ };
54
+ const mode = completion.mode ?? "both";
55
+ const shells = completion.shells;
56
+ if (completion.name === "singular") return {
57
+ mode,
58
+ shells,
59
+ name: "singular",
60
+ helpVisibility: completion.helpVisibility ?? "singular",
61
+ onShow: () => node_process.default.exit(0)
62
+ };
63
+ if (completion.name === "plural") return {
64
+ mode,
65
+ shells,
66
+ name: "plural",
67
+ helpVisibility: completion.helpVisibility ?? "plural",
68
+ onShow: () => node_process.default.exit(0)
69
+ };
70
+ return {
71
+ mode,
72
+ shells,
73
+ name: "both",
74
+ helpVisibility: completion.helpVisibility ?? "both",
75
+ onShow: () => node_process.default.exit(0)
76
+ };
77
+ })();
51
78
  return (0, __optique_core_facade.runParser)(parser, programName, args, {
52
79
  stderr(line) {
53
80
  node_process.default.stderr.write(`${line}\n`);
package/dist/run.d.cts CHANGED
@@ -79,17 +79,16 @@ interface RunOptions {
79
79
  * - `"both"`: Both `completion` subcommand and `--completion` option are available
80
80
  * - `object`: Advanced configuration with mode and custom shells
81
81
  * - `mode`: "command" | "option" | "both" (default: "both")
82
+ * - `name`: "singular" | "plural" | "both" (default: "both")
83
+ * - `helpVisibility`: "singular" | "plural" | "both" | "none"
84
+ * (default: matches `name`)
82
85
  * - `shells`: Custom shell completions (optional)
83
86
  *
84
87
  * When not provided, completion functionality is disabled.
85
88
  *
86
89
  * @since 0.6.0
87
90
  */
88
- readonly completion?: "command" | "option" | "both" | {
89
- readonly mode?: "command" | "option" | "both";
90
- readonly name?: "singular" | "plural" | "both";
91
- readonly shells?: Record<string, ShellCompletion>;
92
- };
91
+ readonly completion?: "command" | "option" | "both" | CompletionOptions;
93
92
  /**
94
93
  * What to display above error messages:
95
94
  *
@@ -143,6 +142,39 @@ interface RunOptions {
143
142
  */
144
143
  readonly footer?: Message;
145
144
  }
145
+ type CompletionHelpVisibility = "singular" | "plural" | "both" | "none";
146
+ type CompletionOptionsBase = {
147
+ readonly mode?: "command" | "option" | "both";
148
+ readonly shells?: Record<string, ShellCompletion>;
149
+ };
150
+ type CompletionOptionsBoth = CompletionOptionsBase & {
151
+ readonly name?: "both";
152
+ /**
153
+ * Controls which completion aliases are shown in help and usage output.
154
+ *
155
+ * @since 0.10.0
156
+ */
157
+ readonly helpVisibility?: CompletionHelpVisibility;
158
+ };
159
+ type CompletionOptionsSingular = CompletionOptionsBase & {
160
+ readonly name: "singular";
161
+ /**
162
+ * Controls which completion aliases are shown in help and usage output.
163
+ *
164
+ * @since 0.10.0
165
+ */
166
+ readonly helpVisibility?: "singular" | "none";
167
+ };
168
+ type CompletionOptionsPlural = CompletionOptionsBase & {
169
+ readonly name: "plural";
170
+ /**
171
+ * Controls which completion aliases are shown in help and usage output.
172
+ *
173
+ * @since 0.10.0
174
+ */
175
+ readonly helpVisibility?: "plural" | "none";
176
+ };
177
+ type CompletionOptions = CompletionOptionsBoth | CompletionOptionsSingular | CompletionOptionsPlural;
146
178
  /**
147
179
  * Runs a command-line parser with automatic process integration.
148
180
  *
package/dist/run.d.ts CHANGED
@@ -79,17 +79,16 @@ interface RunOptions {
79
79
  * - `"both"`: Both `completion` subcommand and `--completion` option are available
80
80
  * - `object`: Advanced configuration with mode and custom shells
81
81
  * - `mode`: "command" | "option" | "both" (default: "both")
82
+ * - `name`: "singular" | "plural" | "both" (default: "both")
83
+ * - `helpVisibility`: "singular" | "plural" | "both" | "none"
84
+ * (default: matches `name`)
82
85
  * - `shells`: Custom shell completions (optional)
83
86
  *
84
87
  * When not provided, completion functionality is disabled.
85
88
  *
86
89
  * @since 0.6.0
87
90
  */
88
- readonly completion?: "command" | "option" | "both" | {
89
- readonly mode?: "command" | "option" | "both";
90
- readonly name?: "singular" | "plural" | "both";
91
- readonly shells?: Record<string, ShellCompletion>;
92
- };
91
+ readonly completion?: "command" | "option" | "both" | CompletionOptions;
93
92
  /**
94
93
  * What to display above error messages:
95
94
  *
@@ -143,6 +142,39 @@ interface RunOptions {
143
142
  */
144
143
  readonly footer?: Message;
145
144
  }
145
+ type CompletionHelpVisibility = "singular" | "plural" | "both" | "none";
146
+ type CompletionOptionsBase = {
147
+ readonly mode?: "command" | "option" | "both";
148
+ readonly shells?: Record<string, ShellCompletion>;
149
+ };
150
+ type CompletionOptionsBoth = CompletionOptionsBase & {
151
+ readonly name?: "both";
152
+ /**
153
+ * Controls which completion aliases are shown in help and usage output.
154
+ *
155
+ * @since 0.10.0
156
+ */
157
+ readonly helpVisibility?: CompletionHelpVisibility;
158
+ };
159
+ type CompletionOptionsSingular = CompletionOptionsBase & {
160
+ readonly name: "singular";
161
+ /**
162
+ * Controls which completion aliases are shown in help and usage output.
163
+ *
164
+ * @since 0.10.0
165
+ */
166
+ readonly helpVisibility?: "singular" | "none";
167
+ };
168
+ type CompletionOptionsPlural = CompletionOptionsBase & {
169
+ readonly name: "plural";
170
+ /**
171
+ * Controls which completion aliases are shown in help and usage output.
172
+ *
173
+ * @since 0.10.0
174
+ */
175
+ readonly helpVisibility?: "plural" | "none";
176
+ };
177
+ type CompletionOptions = CompletionOptionsBoth | CompletionOptionsSingular | CompletionOptionsPlural;
146
178
  /**
147
179
  * Runs a command-line parser with automatic process integration.
148
180
  *
package/dist/run.js CHANGED
@@ -41,12 +41,39 @@ function runImpl(parserOrProgram, options = {}) {
41
41
  value: typeof version === "string" ? version : version.value,
42
42
  onShow: () => process.exit(0)
43
43
  } : void 0;
44
- const completionConfig = completion ? {
45
- mode: typeof completion === "string" ? completion : completion.mode ?? "both",
46
- shells: typeof completion === "string" ? void 0 : completion.shells,
47
- name: typeof completion === "string" ? "both" : completion.name ?? "both",
48
- onShow: () => process.exit(0)
49
- } : void 0;
44
+ const completionConfig = (() => {
45
+ if (!completion) return void 0;
46
+ if (typeof completion === "string") return {
47
+ mode: completion,
48
+ shells: void 0,
49
+ name: "both",
50
+ helpVisibility: "both",
51
+ onShow: () => process.exit(0)
52
+ };
53
+ const mode = completion.mode ?? "both";
54
+ const shells = completion.shells;
55
+ if (completion.name === "singular") return {
56
+ mode,
57
+ shells,
58
+ name: "singular",
59
+ helpVisibility: completion.helpVisibility ?? "singular",
60
+ onShow: () => process.exit(0)
61
+ };
62
+ if (completion.name === "plural") return {
63
+ mode,
64
+ shells,
65
+ name: "plural",
66
+ helpVisibility: completion.helpVisibility ?? "plural",
67
+ onShow: () => process.exit(0)
68
+ };
69
+ return {
70
+ mode,
71
+ shells,
72
+ name: "both",
73
+ helpVisibility: completion.helpVisibility ?? "both",
74
+ onShow: () => process.exit(0)
75
+ };
76
+ })();
50
77
  return runParser(parser, programName, args, {
51
78
  stderr(line) {
52
79
  process.stderr.write(`${line}\n`);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@optique/run",
3
- "version": "0.10.0-dev.360+0d55f751",
3
+ "version": "0.10.0-dev.363+787c7d2e",
4
4
  "description": "Type-safe combinatorial command-line interface parser",
5
5
  "keywords": [
6
6
  "CLI",
@@ -70,7 +70,7 @@
70
70
  },
71
71
  "sideEffects": false,
72
72
  "dependencies": {
73
- "@optique/core": "0.10.0-dev.360+0d55f751"
73
+ "@optique/core": "0.10.0-dev.363+787c7d2e"
74
74
  },
75
75
  "devDependencies": {
76
76
  "@types/node": "^20.19.9",