@bemoje/cli 0.2.1 → 0.3.0
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/index.d.ts +6 -0
- package/index.js +6 -0
- package/lib/Command.d.ts +293 -0
- package/lib/Command.js +435 -0
- package/lib/CommandHelpAdapter.d.ts +157 -0
- package/lib/CommandHelpAdapter.js +100 -0
- package/lib/CommanderHelpAdapter.d.ts +56 -0
- package/lib/CommanderHelpAdapter.js +90 -0
- package/lib/Help.d.ts +263 -0
- package/lib/Help.js +477 -0
- package/lib/internal/lazyProp.d.ts +5 -0
- package/lib/internal/lazyProp.js +24 -0
- package/lib/renderHelp.d.ts +6 -0
- package/lib/renderHelp.js +12 -0
- package/package.json +25 -37
- package/LICENSE +0 -21
- package/README.md +0 -34
- package/cjs/arg/ArgumentBuilder.d.ts +0 -23
- package/cjs/arg/ArgumentBuilder.d.ts.map +0 -1
- package/cjs/arg/ArgumentBuilder.js +0 -52
- package/cjs/arg/ArgumentBuilder.js.map +0 -1
- package/cjs/arg/ArgumentParserSelector.d.ts +0 -9
- package/cjs/arg/ArgumentParserSelector.d.ts.map +0 -1
- package/cjs/arg/ArgumentParserSelector.js +0 -15
- package/cjs/arg/ArgumentParserSelector.js.map +0 -1
- package/cjs/arg/ArgumentReader.d.ts +0 -15
- package/cjs/arg/ArgumentReader.d.ts.map +0 -1
- package/cjs/arg/ArgumentReader.js +0 -38
- package/cjs/arg/ArgumentReader.js.map +0 -1
- package/cjs/arg/ArgumentValidatorSelector.d.ts +0 -8
- package/cjs/arg/ArgumentValidatorSelector.d.ts.map +0 -1
- package/cjs/arg/ArgumentValidatorSelector.js +0 -16
- package/cjs/arg/ArgumentValidatorSelector.js.map +0 -1
- package/cjs/cmd/CommandBuilder.d.ts +0 -410
- package/cjs/cmd/CommandBuilder.d.ts.map +0 -1
- package/cjs/cmd/CommandBuilder.js +0 -1277
- package/cjs/cmd/CommandBuilder.js.map +0 -1
- package/cjs/cmd/CommandBuilderMetaData.d.ts +0 -26
- package/cjs/cmd/CommandBuilderMetaData.d.ts.map +0 -1
- package/cjs/cmd/CommandBuilderMetaData.js +0 -45
- package/cjs/cmd/CommandBuilderMetaData.js.map +0 -1
- package/cjs/cmd/CommandFeatureSelector.d.ts +0 -80
- package/cjs/cmd/CommandFeatureSelector.d.ts.map +0 -1
- package/cjs/cmd/CommandFeatureSelector.js +0 -114
- package/cjs/cmd/CommandFeatureSelector.js.map +0 -1
- package/cjs/cmd/DefaultHelpConfig.d.ts +0 -29
- package/cjs/cmd/DefaultHelpConfig.d.ts.map +0 -1
- package/cjs/cmd/DefaultHelpConfig.js +0 -177
- package/cjs/cmd/DefaultHelpConfig.js.map +0 -1
- package/cjs/cmd/commanderBackRefs.d.ts +0 -10
- package/cjs/cmd/commanderBackRefs.d.ts.map +0 -1
- package/cjs/cmd/commanderBackRefs.js +0 -38
- package/cjs/cmd/commanderBackRefs.js.map +0 -1
- package/cjs/core/OutputManager.d.ts +0 -64
- package/cjs/core/OutputManager.d.ts.map +0 -1
- package/cjs/core/OutputManager.js +0 -92
- package/cjs/core/OutputManager.js.map +0 -1
- package/cjs/core/ParserSelector.d.ts +0 -23
- package/cjs/core/ParserSelector.d.ts.map +0 -1
- package/cjs/core/ParserSelector.js +0 -46
- package/cjs/core/ParserSelector.js.map +0 -1
- package/cjs/core/ValidatorSelector.d.ts +0 -19
- package/cjs/core/ValidatorSelector.d.ts.map +0 -1
- package/cjs/core/ValidatorSelector.js +0 -42
- package/cjs/core/ValidatorSelector.js.map +0 -1
- package/cjs/core/splitCombinedArgvShorts.d.ts +0 -2
- package/cjs/core/splitCombinedArgvShorts.d.ts.map +0 -1
- package/cjs/core/splitCombinedArgvShorts.js +0 -15
- package/cjs/core/splitCombinedArgvShorts.js.map +0 -1
- package/cjs/db/AbstractJsonFileSection.d.ts +0 -136
- package/cjs/db/AbstractJsonFileSection.d.ts.map +0 -1
- package/cjs/db/AbstractJsonFileSection.js +0 -190
- package/cjs/db/AbstractJsonFileSection.js.map +0 -1
- package/cjs/db/AppDataSection.d.ts +0 -31
- package/cjs/db/AppDataSection.d.ts.map +0 -1
- package/cjs/db/AppDataSection.js +0 -49
- package/cjs/db/AppDataSection.js.map +0 -1
- package/cjs/db/ConfigSection.d.ts +0 -46
- package/cjs/db/ConfigSection.d.ts.map +0 -1
- package/cjs/db/ConfigSection.js +0 -71
- package/cjs/db/ConfigSection.js.map +0 -1
- package/cjs/db/JsonFile.d.ts +0 -36
- package/cjs/db/JsonFile.d.ts.map +0 -1
- package/cjs/db/JsonFile.js +0 -60
- package/cjs/db/JsonFile.js.map +0 -1
- package/cjs/db/PresetsSection.d.ts +0 -45
- package/cjs/db/PresetsSection.d.ts.map +0 -1
- package/cjs/db/PresetsSection.js +0 -82
- package/cjs/db/PresetsSection.js.map +0 -1
- package/cjs/index.d.ts +0 -26
- package/cjs/index.d.ts.map +0 -1
- package/cjs/index.js +0 -29
- package/cjs/index.js.map +0 -1
- package/cjs/opt/OptionArgumentParserSelector.d.ts +0 -8
- package/cjs/opt/OptionArgumentParserSelector.d.ts.map +0 -1
- package/cjs/opt/OptionArgumentParserSelector.js +0 -16
- package/cjs/opt/OptionArgumentParserSelector.js.map +0 -1
- package/cjs/opt/OptionArgumentValidatorSelector.d.ts +0 -8
- package/cjs/opt/OptionArgumentValidatorSelector.d.ts.map +0 -1
- package/cjs/opt/OptionArgumentValidatorSelector.js +0 -19
- package/cjs/opt/OptionArgumentValidatorSelector.js.map +0 -1
- package/cjs/opt/OptionBuilder.d.ts +0 -32
- package/cjs/opt/OptionBuilder.d.ts.map +0 -1
- package/cjs/opt/OptionBuilder.js +0 -97
- package/cjs/opt/OptionBuilder.js.map +0 -1
- package/cjs/opt/OptionHelpers.d.ts +0 -33
- package/cjs/opt/OptionHelpers.d.ts.map +0 -1
- package/cjs/opt/OptionHelpers.js +0 -57
- package/cjs/opt/OptionHelpers.js.map +0 -1
- package/cjs/opt/OptionReader.d.ts +0 -24
- package/cjs/opt/OptionReader.d.ts.map +0 -1
- package/cjs/opt/OptionReader.js +0 -66
- package/cjs/opt/OptionReader.js.map +0 -1
- package/cjs/types/IConfig.d.ts +0 -22
- package/cjs/types/IConfig.d.ts.map +0 -1
- package/cjs/types/IConfig.js +0 -3
- package/cjs/types/IConfig.js.map +0 -1
- package/cjs/types/IPreset.d.ts +0 -15
- package/cjs/types/IPreset.d.ts.map +0 -1
- package/cjs/types/IPreset.js +0 -3
- package/cjs/types/IPreset.js.map +0 -1
package/index.d.ts
ADDED
package/index.js
ADDED
package/lib/Command.d.ts
ADDED
|
@@ -0,0 +1,293 @@
|
|
|
1
|
+
import type { ParseArgsOptionDescriptor } from 'node:util';
|
|
2
|
+
import type { IHelp } from './Help';
|
|
3
|
+
import { CommandHelpAdapter } from './CommandHelpAdapter';
|
|
4
|
+
/**
|
|
5
|
+
* Command-line argument parser with fluent API and type-safe validation.
|
|
6
|
+
* Enforces CLI argument ordering rules and provides structured parsing results.
|
|
7
|
+
*
|
|
8
|
+
* @example
|
|
9
|
+
* ```typescript
|
|
10
|
+
* const cmd = new Command('myapp')
|
|
11
|
+
* .argument('<input>', 'input file')
|
|
12
|
+
* .argument('[output]', 'output file', 'out.txt')
|
|
13
|
+
* .option('-v, --verbose', 'verbose output')
|
|
14
|
+
* .option('-f, --format <type>', 'output format')
|
|
15
|
+
*
|
|
16
|
+
* const result = cmd.parse(['input.txt', '-v', '-f', 'json'])
|
|
17
|
+
* ```
|
|
18
|
+
*/
|
|
19
|
+
export declare class Command implements CommandDescriptor {
|
|
20
|
+
/** Command name used for invocation */
|
|
21
|
+
name: string;
|
|
22
|
+
/** Optional version string */
|
|
23
|
+
version?: string;
|
|
24
|
+
/** Alternative names for this command */
|
|
25
|
+
aliases: string[];
|
|
26
|
+
/** Brief single-line description */
|
|
27
|
+
summary?: string;
|
|
28
|
+
/** Full command description */
|
|
29
|
+
description: string;
|
|
30
|
+
/** Whether command should be hidden from help */
|
|
31
|
+
hidden?: boolean;
|
|
32
|
+
/** Group name for organizing commands in help */
|
|
33
|
+
group?: string;
|
|
34
|
+
/** Parent command if this is a subcommand */
|
|
35
|
+
parent: Command | null;
|
|
36
|
+
/** Child subcommands */
|
|
37
|
+
commands: Command[];
|
|
38
|
+
/** Positional arguments */
|
|
39
|
+
arguments: ArgumentDescriptor[];
|
|
40
|
+
/** Named options/flags */
|
|
41
|
+
options: OptionDescriptor[];
|
|
42
|
+
/** Help system configuration */
|
|
43
|
+
helpConfiguration: Partial<IHelp>;
|
|
44
|
+
constructor(name?: string, parent?: Command | null);
|
|
45
|
+
/** Updates multiple command properties at once */
|
|
46
|
+
setState(state: Partial<CommandDescriptor>): this;
|
|
47
|
+
/** Serializes command to JSON, maintaining compatibility with previous state-based structure */
|
|
48
|
+
toJSON(): {
|
|
49
|
+
name: string;
|
|
50
|
+
version: string;
|
|
51
|
+
aliases: string[];
|
|
52
|
+
summary: string;
|
|
53
|
+
description: string;
|
|
54
|
+
hidden: boolean;
|
|
55
|
+
group: string;
|
|
56
|
+
commands: Command[];
|
|
57
|
+
arguments: ArgumentDescriptor[];
|
|
58
|
+
options: OptionDescriptor[];
|
|
59
|
+
helpConfiguration: Partial<IHelp>;
|
|
60
|
+
};
|
|
61
|
+
/** Sets the command name */
|
|
62
|
+
setName(name: string): void;
|
|
63
|
+
/** Sets command aliases, flattening nested arrays */
|
|
64
|
+
setAliases(...aliases: (string | string[])[]): this;
|
|
65
|
+
/** Adds aliases to existing ones */
|
|
66
|
+
addAliases(...aliases: (string | string[])[]): this;
|
|
67
|
+
/** Sets the command version */
|
|
68
|
+
setVersion(version?: string): this;
|
|
69
|
+
/** Sets the command summary */
|
|
70
|
+
setSummary(summary?: string): this;
|
|
71
|
+
/** Sets command description, joining multiple lines */
|
|
72
|
+
setDescription(...lines: string[]): this;
|
|
73
|
+
/** Sets whether command is hidden from help */
|
|
74
|
+
setHidden(hidden?: boolean | undefined): this;
|
|
75
|
+
/** Sets the command group for help organization */
|
|
76
|
+
setGroup(group?: Exclude<string, 'Options' | 'Global Options'>): this;
|
|
77
|
+
/** Sets the parent command */
|
|
78
|
+
setParent(parent: Command | null): this;
|
|
79
|
+
/** Extends existing help configuration with new settings */
|
|
80
|
+
extendHelpConfiguration(config: Partial<IHelp>): this;
|
|
81
|
+
/** Sets help configuration, using defaults if not provided */
|
|
82
|
+
setHelpConfiguration(config?: Partial<IHelp>): this;
|
|
83
|
+
/** Creates and adds a subcommand */
|
|
84
|
+
subcommand(name: string): Command;
|
|
85
|
+
/** Add required argument. Usage: `<name>` */
|
|
86
|
+
argument(usage: `<${string}>`, description: string, options?: ArgOpts<RequiredArgumentDescriptor>): this;
|
|
87
|
+
/** Add optional argument with default. Usage: `[name]` */
|
|
88
|
+
argument(usage: `[${string}]`, description: string, options?: ArgOpts<OptionalArgumentDescriptor>): this;
|
|
89
|
+
/** Add required variadic argument. Usage: `<name...>` */
|
|
90
|
+
argument(usage: `<${string}...>`, description: string, options?: ArgOpts<RequiredVariadicArgumentDescriptor>): this;
|
|
91
|
+
/** Add optional variadic argument with defaults. Usage: `[name...]` */
|
|
92
|
+
argument(usage: `[${string}...]`, description: string, options?: ArgOpts<OptionalVariadicArgumentDescriptor>): this;
|
|
93
|
+
/** Add required string option. Usage: `-f, --file <path>` */
|
|
94
|
+
option(usage: `-${string}, --${string} <${string}>`, description: string, options?: OptOpts<RequiredOptionDescriptor>): this;
|
|
95
|
+
/** Add optional string option with default. Usage: `-o, --output [path]` */
|
|
96
|
+
option(usage: `-${string}, --${string} [${string}]`, description: string, options?: OptOpts<OptionalOptionDescriptor>): this;
|
|
97
|
+
/** Add required variadic option. Usage: `-i, --include <patterns...>` */
|
|
98
|
+
option(usage: `-${string}, --${string} <${string}...>`, description: string, options?: OptOpts<RequiredVariadicOptionDescriptor>): this;
|
|
99
|
+
/** Add optional variadic option with defaults. Usage: `-e, --exclude [patterns...]` */
|
|
100
|
+
option(usage: `-${string}, --${string} [${string}...]`, description: string, options?: OptOpts<OptionalVariadicOptionDescriptor>): this;
|
|
101
|
+
/** Add boolean flag option. Usage: `-v, --verbose` */
|
|
102
|
+
option(usage: `-${string}, --${string}`, description: string, options?: OptOpts<BooleanOptionDescriptor>): this;
|
|
103
|
+
/**
|
|
104
|
+
* Parses command-line arguments with subcommand support and type-safe validation.
|
|
105
|
+
*
|
|
106
|
+
* @example
|
|
107
|
+
* ```typescript
|
|
108
|
+
* const result = cmd.parse(['input.txt', '-v', '--format', 'json'])
|
|
109
|
+
* // { arguments: ['input.txt'], options: { verbose: true, format: 'json' } }
|
|
110
|
+
* ```
|
|
111
|
+
*/
|
|
112
|
+
parse(argv?: string[], globalOptions?: OptionDescriptor[]): {
|
|
113
|
+
command: Command;
|
|
114
|
+
arguments: (string | string[])[];
|
|
115
|
+
options: {
|
|
116
|
+
[x: string]: string | boolean | (string | boolean)[] | undefined;
|
|
117
|
+
};
|
|
118
|
+
};
|
|
119
|
+
/** Validates CLI argument ordering */
|
|
120
|
+
protected assertNoOptionalOrVariadicArguments(): void;
|
|
121
|
+
/** Validates optional args don't follow variadic args */
|
|
122
|
+
protected assertNoVariadicArgument(): void;
|
|
123
|
+
/** Ensures only one variadic argument per command */
|
|
124
|
+
protected assertNoMultipleVariadicArguments(): void;
|
|
125
|
+
/** Ensures unique argument names across arguments and options */
|
|
126
|
+
protected assertArgumentNameNotInUse(name: string): void;
|
|
127
|
+
/** Validates option short names are single alphanumeric characters */
|
|
128
|
+
protected assertOptionShortNameIsValid(short: string): void;
|
|
129
|
+
/** Validates option short names are unique across command hierarchy */
|
|
130
|
+
protected assertOptionShortNameNotInUse(short: string): void;
|
|
131
|
+
/** Validates option names are unique across command hierarchy */
|
|
132
|
+
protected assertOptionNameNotInUse(name: string): void;
|
|
133
|
+
/** Returns command and all ancestor commands in hierarchy */
|
|
134
|
+
getCommandAndAncestors(): Command[];
|
|
135
|
+
/** Returns all ancestor commands excluding this command */
|
|
136
|
+
getAncestors(): Command[];
|
|
137
|
+
/** Returns all options from this command and ancestors */
|
|
138
|
+
getOptionsInclAncestors(): OptionDescriptor[];
|
|
139
|
+
/** Finds subcommand by name or alias */
|
|
140
|
+
findCommand(this: Command, name: string): Command;
|
|
141
|
+
/** Finds option by short or long name */
|
|
142
|
+
findOption(this: Command, arg: string): OptionDescriptor | undefined;
|
|
143
|
+
/** Returns a view that is compliant with the CommandHelp interface */
|
|
144
|
+
createHelpAdapter(): CommandHelpAdapter;
|
|
145
|
+
/** Renders formatted help text using provided help definition */
|
|
146
|
+
renderHelp(help: IHelp): string;
|
|
147
|
+
}
|
|
148
|
+
/** Usage patterns for boolean flag options */
|
|
149
|
+
type BooleanOptionUsage = `-${string}, --${string}`;
|
|
150
|
+
/** Usage patterns for required string options */
|
|
151
|
+
type RequiredOptionUsage = `-${string}, --${string} <${string}>`;
|
|
152
|
+
/** Usage patterns for optional string options */
|
|
153
|
+
type OptionalOptionUsage = `-${string}, --${string} [${string}]`;
|
|
154
|
+
/** Usage patterns for required variadic options */
|
|
155
|
+
type RequiredVariadicOptionUsage = `-${string}, --${string} <${string}...>`;
|
|
156
|
+
/** Usage patterns for optional variadic options */
|
|
157
|
+
type OptionalVariadicOptionUsage = `-${string}, --${string} [${string}...]`;
|
|
158
|
+
/** Union of all option usage pattern types */
|
|
159
|
+
export type OptionUsage = BooleanOptionUsage | RequiredOptionUsage | OptionalOptionUsage | RequiredVariadicOptionUsage | OptionalVariadicOptionUsage;
|
|
160
|
+
/** Usage pattern for required positional arguments */
|
|
161
|
+
type RequiredArgumentUsage = `<${string}>`;
|
|
162
|
+
/** Usage pattern for optional positional arguments */
|
|
163
|
+
type OptionalArgumentUsage = `[${string}]`;
|
|
164
|
+
/** Usage pattern for required variadic arguments */
|
|
165
|
+
type RequiredVariadicArgumentUsage = `<${string}...>`;
|
|
166
|
+
/** Usage pattern for optional variadic arguments */
|
|
167
|
+
type OptionalVariadicArgumentUsage = `[${string}...]`;
|
|
168
|
+
/** Union of all argument usage pattern types */
|
|
169
|
+
export type ArgumentUsage = RequiredArgumentUsage | OptionalArgumentUsage | RequiredVariadicArgumentUsage | OptionalVariadicArgumentUsage;
|
|
170
|
+
/** Base descriptor for command-line arguments with shared properties */
|
|
171
|
+
interface ArgumentDescriptorBase {
|
|
172
|
+
name: string;
|
|
173
|
+
required: boolean;
|
|
174
|
+
description: string;
|
|
175
|
+
multiple: boolean;
|
|
176
|
+
choices?: string[];
|
|
177
|
+
defaultValue?: string | string[] | never;
|
|
178
|
+
defaultValueDescription?: string | never;
|
|
179
|
+
}
|
|
180
|
+
/** Required positional argument descriptor. Usage: `<name>` */
|
|
181
|
+
interface RequiredArgumentDescriptor extends ArgumentDescriptorBase {
|
|
182
|
+
multiple: false;
|
|
183
|
+
required: true;
|
|
184
|
+
defaultValue?: never;
|
|
185
|
+
defaultValueDescription?: never;
|
|
186
|
+
}
|
|
187
|
+
/** Optional positional argument with string default. Usage: `[name]` */
|
|
188
|
+
interface OptionalArgumentDescriptor extends ArgumentDescriptorBase {
|
|
189
|
+
required: false;
|
|
190
|
+
multiple: false;
|
|
191
|
+
defaultValue?: string;
|
|
192
|
+
defaultValueDescription?: string;
|
|
193
|
+
}
|
|
194
|
+
/** Required variadic argument accepting multiple values. Usage: `<name...>` */
|
|
195
|
+
interface RequiredVariadicArgumentDescriptor extends ArgumentDescriptorBase {
|
|
196
|
+
required: true;
|
|
197
|
+
multiple: true;
|
|
198
|
+
defaultValue?: never;
|
|
199
|
+
defaultValueDescription?: never;
|
|
200
|
+
}
|
|
201
|
+
/** Optional variadic argument with array default. Usage: `[name...]` */
|
|
202
|
+
interface OptionalVariadicArgumentDescriptor extends ArgumentDescriptorBase {
|
|
203
|
+
required: false;
|
|
204
|
+
multiple: true;
|
|
205
|
+
defaultValue?: string[];
|
|
206
|
+
defaultValueDescription?: string;
|
|
207
|
+
}
|
|
208
|
+
/** Base descriptor for command-line options with shared properties */
|
|
209
|
+
interface OptionDescriptorBase extends ParseArgsOptionDescriptor {
|
|
210
|
+
type: 'boolean' | 'string';
|
|
211
|
+
short: string;
|
|
212
|
+
name: string;
|
|
213
|
+
argName?: string | never;
|
|
214
|
+
description: string;
|
|
215
|
+
required: boolean;
|
|
216
|
+
multiple: boolean;
|
|
217
|
+
defaultValue?: boolean | string | string[] | never;
|
|
218
|
+
defaultValueDescription?: string | never;
|
|
219
|
+
env?: string;
|
|
220
|
+
hidden?: boolean;
|
|
221
|
+
choices?: string[];
|
|
222
|
+
group?: string;
|
|
223
|
+
}
|
|
224
|
+
/** Boolean flag option. Usage: `-v, --verbose` */
|
|
225
|
+
interface BooleanOptionDescriptor extends OptionDescriptorBase {
|
|
226
|
+
type: 'boolean';
|
|
227
|
+
argName?: never;
|
|
228
|
+
required: false;
|
|
229
|
+
multiple: false;
|
|
230
|
+
defaultValue?: boolean;
|
|
231
|
+
defaultValueDescription?: string;
|
|
232
|
+
}
|
|
233
|
+
/** Required string option. Usage: `-f, --file <path>` */
|
|
234
|
+
interface RequiredOptionDescriptor extends OptionDescriptorBase {
|
|
235
|
+
type: 'string';
|
|
236
|
+
argName: string;
|
|
237
|
+
required: true;
|
|
238
|
+
multiple: false;
|
|
239
|
+
defaultValue?: never;
|
|
240
|
+
defaultValueDescription?: never;
|
|
241
|
+
}
|
|
242
|
+
/** Optional string option with default. Usage: `-o, --output [path]` */
|
|
243
|
+
interface OptionalOptionDescriptor extends OptionDescriptorBase {
|
|
244
|
+
type: 'string';
|
|
245
|
+
argName: string;
|
|
246
|
+
required: false;
|
|
247
|
+
multiple: false;
|
|
248
|
+
defaultValue?: string;
|
|
249
|
+
defaultValueDescription?: string;
|
|
250
|
+
}
|
|
251
|
+
/** Required option accepting multiple values. Usage: `-i, --include <patterns...>` */
|
|
252
|
+
interface RequiredVariadicOptionDescriptor extends OptionDescriptorBase {
|
|
253
|
+
type: 'string';
|
|
254
|
+
argName: string;
|
|
255
|
+
required: true;
|
|
256
|
+
multiple: true;
|
|
257
|
+
defaultValue?: never;
|
|
258
|
+
defaultValueDescription?: never;
|
|
259
|
+
}
|
|
260
|
+
/** Optional option accepting multiple values with defaults. Usage: `-e, --exclude [patterns...]` */
|
|
261
|
+
interface OptionalVariadicOptionDescriptor extends OptionDescriptorBase {
|
|
262
|
+
type: 'string';
|
|
263
|
+
argName: string;
|
|
264
|
+
required: false;
|
|
265
|
+
multiple: true;
|
|
266
|
+
defaultValue?: string[];
|
|
267
|
+
defaultValueDescription?: string;
|
|
268
|
+
}
|
|
269
|
+
/** Complete command configuration including all properties and substructures */
|
|
270
|
+
export interface CommandDescriptor {
|
|
271
|
+
name: string;
|
|
272
|
+
version?: string;
|
|
273
|
+
aliases: string[];
|
|
274
|
+
summary?: string;
|
|
275
|
+
description: string;
|
|
276
|
+
hidden?: boolean;
|
|
277
|
+
group?: string;
|
|
278
|
+
parent: Command | null;
|
|
279
|
+
commands: Command[];
|
|
280
|
+
arguments: ArgumentDescriptor[];
|
|
281
|
+
options: OptionDescriptor[];
|
|
282
|
+
helpConfiguration: Partial<IHelp>;
|
|
283
|
+
}
|
|
284
|
+
/** Union type for all argument descriptor variants */
|
|
285
|
+
export type ArgumentDescriptor = RequiredArgumentDescriptor | OptionalArgumentDescriptor | RequiredVariadicArgumentDescriptor | OptionalVariadicArgumentDescriptor;
|
|
286
|
+
/** Union type for all option descriptor variants */
|
|
287
|
+
export type OptionDescriptor = BooleanOptionDescriptor | RequiredOptionDescriptor | OptionalOptionDescriptor | RequiredVariadicOptionDescriptor | OptionalVariadicOptionDescriptor;
|
|
288
|
+
/** Helper type for extracting argument configuration options */
|
|
289
|
+
type ArgOpts<T extends ArgumentDescriptor> = Omit<T, 'name' | 'description' | 'required' | 'multiple'>;
|
|
290
|
+
/** Helper type for extracting option configuration options */
|
|
291
|
+
type OptOpts<T extends OptionDescriptor> = Omit<T, 'name' | 'description' | 'required' | 'multiple' | 'type' | 'argName' | 'short' | 'long'>;
|
|
292
|
+
export {};
|
|
293
|
+
//# sourceMappingURL=Command.d.ts.map
|