UNPKG

26.3 kBTypeScriptView Raw
1// Type definitions for commander
2// Original definitions by: Alan Agius <https://github.com/alan-agius4>, Marcelo Dezem <https://github.com/mdezem>, vvakame <https://github.com/vvakame>, Jules Randolph <https://github.com/sveinburne>
3
4// Using method rather than property for method-signature-style, to document method overloads separately. Allow either.
5/* eslint-disable @typescript-eslint/method-signature-style */
6/* eslint-disable @typescript-eslint/no-explicit-any */
7
8export class CommanderError extends Error {
9 code: string;
10 exitCode: number;
11 message: string;
12 nestedError?: string;
13
14 /**
15 * Constructs the CommanderError class
16 * @param exitCode - suggested exit code which could be used with process.exit
17 * @param code - an id string representing the error
18 * @param message - human-readable description of the error
19 * @constructor
20 */
21 constructor(exitCode: number, code: string, message: string);
22}
23
24export class InvalidArgumentError extends CommanderError {
25 /**
26 * Constructs the InvalidArgumentError class
27 * @param message - explanation of why argument is invalid
28 * @constructor
29 */
30 constructor(message: string);
31}
32export { InvalidArgumentError as InvalidOptionArgumentError }; // deprecated old name
33
34export interface ErrorOptions { // optional parameter for error()
35 /** an id string representing the error */
36 code?: string;
37 /** suggested exit code which could be used with process.exit */
38 exitCode?: number;
39}
40
41export class Argument {
42 description: string;
43 required: boolean;
44 variadic: boolean;
45
46 /**
47 * Initialize a new command argument with the given name and description.
48 * The default is that the argument is required, and you can explicitly
49 * indicate this with <> around the name. Put [] around the name for an optional argument.
50 */
51 constructor(arg: string, description?: string);
52
53 /**
54 * Return argument name.
55 */
56 name(): string;
57
58 /**
59 * Set the default value, and optionally supply the description to be displayed in the help.
60 */
61 default(value: unknown, description?: string): this;
62
63 /**
64 * Set the custom handler for processing CLI command arguments into argument values.
65 */
66 argParser<T>(fn: (value: string, previous: T) => T): this;
67
68 /**
69 * Only allow argument value to be one of choices.
70 */
71 choices(values: readonly string[]): this;
72
73 /**
74 * Make argument required.
75 */
76 argRequired(): this;
77
78 /**
79 * Make argument optional.
80 */
81 argOptional(): this;
82}
83
84export class Option {
85 flags: string;
86 description: string;
87
88 required: boolean; // A value must be supplied when the option is specified.
89 optional: boolean; // A value is optional when the option is specified.
90 variadic: boolean;
91 mandatory: boolean; // The option must have a value after parsing, which usually means it must be specified on command line.
92 optionFlags: string;
93 short?: string;
94 long?: string;
95 negate: boolean;
96 defaultValue?: any;
97 defaultValueDescription?: string;
98 parseArg?: <T>(value: string, previous: T) => T;
99 hidden: boolean;
100 argChoices?: string[];
101
102 constructor(flags: string, description?: string);
103
104 /**
105 * Set the default value, and optionally supply the description to be displayed in the help.
106 */
107 default(value: unknown, description?: string): this;
108
109 /**
110 * Preset to use when option used without option-argument, especially optional but also boolean and negated.
111 * The custom processing (parseArg) is called.
112 *
113 * @example
114 * ```ts
115 * new Option('--color').default('GREYSCALE').preset('RGB');
116 * new Option('--donate [amount]').preset('20').argParser(parseFloat);
117 * ```
118 */
119 preset(arg: unknown): this;
120
121 /**
122 * Set environment variable to check for option value.
123 * Priority order of option values is default < env < cli
124 */
125 env(name: string): this;
126
127 /**
128 * Calculate the full description, including defaultValue etc.
129 */
130 fullDescription(): string;
131
132 /**
133 * Set the custom handler for processing CLI option arguments into option values.
134 */
135 argParser<T>(fn: (value: string, previous: T) => T): this;
136
137 /**
138 * Whether the option is mandatory and must have a value after parsing.
139 */
140 makeOptionMandatory(mandatory?: boolean): this;
141
142 /**
143 * Hide option in help.
144 */
145 hideHelp(hide?: boolean): this;
146
147 /**
148 * Only allow option value to be one of choices.
149 */
150 choices(values: readonly string[]): this;
151
152 /**
153 * Return option name.
154 */
155 name(): string;
156
157 /**
158 * Return option name, in a camelcase format that can be used
159 * as a object attribute key.
160 */
161 attributeName(): string;
162
163 /**
164 * Return whether a boolean option.
165 *
166 * Options are one of boolean, negated, required argument, or optional argument.
167 */
168 isBoolean(): boolean;
169}
170
171export class Help {
172 /** output helpWidth, long lines are wrapped to fit */
173 helpWidth?: number;
174 sortSubcommands: boolean;
175 sortOptions: boolean;
176
177 constructor();
178
179 /** Get the command term to show in the list of subcommands. */
180 subcommandTerm(cmd: Command): string;
181 /** Get the command description to show in the list of subcommands. */
182 subcommandDescription(cmd: Command): string;
183 /** Get the option term to show in the list of options. */
184 optionTerm(option: Option): string;
185 /** Get the option description to show in the list of options. */
186 optionDescription(option: Option): string;
187 /** Get the argument term to show in the list of arguments. */
188 argumentTerm(argument: Argument): string;
189 /** Get the argument description to show in the list of arguments. */
190 argumentDescription(argument: Argument): string;
191
192 /** Get the command usage to be displayed at the top of the built-in help. */
193 commandUsage(cmd: Command): string;
194 /** Get the description for the command. */
195 commandDescription(cmd: Command): string;
196
197 /** Get an array of the visible subcommands. Includes a placeholder for the implicit help command, if there is one. */
198 visibleCommands(cmd: Command): Command[];
199 /** Get an array of the visible options. Includes a placeholder for the implicit help option, if there is one. */
200 visibleOptions(cmd: Command): Option[];
201 /** Get an array of the arguments which have descriptions. */
202 visibleArguments(cmd: Command): Argument[];
203
204 /** Get the longest command term length. */
205 longestSubcommandTermLength(cmd: Command, helper: Help): number;
206 /** Get the longest option term length. */
207 longestOptionTermLength(cmd: Command, helper: Help): number;
208 /** Get the longest argument term length. */
209 longestArgumentTermLength(cmd: Command, helper: Help): number;
210 /** Calculate the pad width from the maximum term length. */
211 padWidth(cmd: Command, helper: Help): number;
212
213 /**
214 * Wrap the given string to width characters per line, with lines after the first indented.
215 * Do not wrap if insufficient room for wrapping (minColumnWidth), or string is manually formatted.
216 */
217 wrap(str: string, width: number, indent: number, minColumnWidth?: number): string;
218
219 /** Generate the built-in help text. */
220 formatHelp(cmd: Command, helper: Help): string;
221}
222export type HelpConfiguration = Partial<Help>;
223
224export interface ParseOptions {
225 from: 'node' | 'electron' | 'user';
226}
227export interface HelpContext { // optional parameter for .help() and .outputHelp()
228 error: boolean;
229}
230export interface AddHelpTextContext { // passed to text function used with .addHelpText()
231 error: boolean;
232 command: Command;
233}
234export interface OutputConfiguration {
235 writeOut?(str: string): void;
236 writeErr?(str: string): void;
237 getOutHelpWidth?(): number;
238 getErrHelpWidth?(): number;
239 outputError?(str: string, write: (str: string) => void): void;
240
241}
242
243export type AddHelpTextPosition = 'beforeAll' | 'before' | 'after' | 'afterAll';
244export type HookEvent = 'preAction' | 'postAction';
245export type OptionValueSource = 'default' | 'env' | 'config' | 'cli';
246
247export interface OptionValues {
248 [key: string]: any;
249}
250
251export class Command {
252 args: string[];
253 processedArgs: any[];
254 commands: Command[];
255 parent: Command | null;
256
257 constructor(name?: string);
258
259 /**
260 * Set the program version to `str`.
261 *
262 * This method auto-registers the "-V, --version" flag
263 * which will print the version number when passed.
264 *
265 * You can optionally supply the flags and description to override the defaults.
266 */
267 version(str: string, flags?: string, description?: string): this;
268
269 /**
270 * Define a command, implemented using an action handler.
271 *
272 * @remarks
273 * The command description is supplied using `.description`, not as a parameter to `.command`.
274 *
275 * @example
276 * ```ts
277 * program
278 * .command('clone <source> [destination]')
279 * .description('clone a repository into a newly created directory')
280 * .action((source, destination) => {
281 * console.log('clone command called');
282 * });
283 * ```
284 *
285 * @param nameAndArgs - command name and arguments, args are `<required>` or `[optional]` and last may also be `variadic...`
286 * @param opts - configuration options
287 * @returns new command
288 */
289 command(nameAndArgs: string, opts?: CommandOptions): ReturnType<this['createCommand']>;
290 /**
291 * Define a command, implemented in a separate executable file.
292 *
293 * @remarks
294 * The command description is supplied as the second parameter to `.command`.
295 *
296 * @example
297 * ```ts
298 * program
299 * .command('start <service>', 'start named service')
300 * .command('stop [service]', 'stop named service, or all if no name supplied');
301 * ```
302 *
303 * @param nameAndArgs - command name and arguments, args are `<required>` or `[optional]` and last may also be `variadic...`
304 * @param description - description of executable command
305 * @param opts - configuration options
306 * @returns `this` command for chaining
307 */
308 command(nameAndArgs: string, description: string, opts?: ExecutableCommandOptions): this;
309
310 /**
311 * Factory routine to create a new unattached command.
312 *
313 * See .command() for creating an attached subcommand, which uses this routine to
314 * create the command. You can override createCommand to customise subcommands.
315 */
316 createCommand(name?: string): Command;
317
318 /**
319 * Add a prepared subcommand.
320 *
321 * See .command() for creating an attached subcommand which inherits settings from its parent.
322 *
323 * @returns `this` command for chaining
324 */
325 addCommand(cmd: Command, opts?: CommandOptions): this;
326
327 /**
328 * Factory routine to create a new unattached argument.
329 *
330 * See .argument() for creating an attached argument, which uses this routine to
331 * create the argument. You can override createArgument to return a custom argument.
332 */
333 createArgument(name: string, description?: string): Argument;
334
335 /**
336 * Define argument syntax for command.
337 *
338 * The default is that the argument is required, and you can explicitly
339 * indicate this with <> around the name. Put [] around the name for an optional argument.
340 *
341 * @example
342 * ```
343 * program.argument('<input-file>');
344 * program.argument('[output-file]');
345 * ```
346 *
347 * @returns `this` command for chaining
348 */
349 argument<T>(flags: string, description: string, fn: (value: string, previous: T) => T, defaultValue?: T): this;
350 argument(name: string, description?: string, defaultValue?: unknown): this;
351
352 /**
353 * Define argument syntax for command, adding a prepared argument.
354 *
355 * @returns `this` command for chaining
356 */
357 addArgument(arg: Argument): this;
358
359 /**
360 * Define argument syntax for command, adding multiple at once (without descriptions).
361 *
362 * See also .argument().
363 *
364 * @example
365 * ```
366 * program.arguments('<cmd> [env]');
367 * ```
368 *
369 * @returns `this` command for chaining
370 */
371 arguments(names: string): this;
372
373 /**
374 * Override default decision whether to add implicit help command.
375 *
376 * @example
377 * ```
378 * addHelpCommand() // force on
379 * addHelpCommand(false); // force off
380 * addHelpCommand('help [cmd]', 'display help for [cmd]'); // force on with custom details
381 * ```
382 *
383 * @returns `this` command for chaining
384 */
385 addHelpCommand(enableOrNameAndArgs?: string | boolean, description?: string): this;
386
387 /**
388 * Add hook for life cycle event.
389 */
390 hook(event: HookEvent, listener: (thisCommand: Command, actionCommand: Command) => void | Promise<void>): this;
391
392 /**
393 * Register callback to use as replacement for calling process.exit.
394 */
395 exitOverride(callback?: (err: CommanderError) => never|void): this;
396
397 /**
398 * Display error message and exit (or call exitOverride).
399 */
400 error(message: string, errorOptions?: ErrorOptions): never;
401
402 /**
403 * You can customise the help with a subclass of Help by overriding createHelp,
404 * or by overriding Help properties using configureHelp().
405 */
406 createHelp(): Help;
407
408 /**
409 * You can customise the help by overriding Help properties using configureHelp(),
410 * or with a subclass of Help by overriding createHelp().
411 */
412 configureHelp(configuration: HelpConfiguration): this;
413 /** Get configuration */
414 configureHelp(): HelpConfiguration;
415
416 /**
417 * The default output goes to stdout and stderr. You can customise this for special
418 * applications. You can also customise the display of errors by overriding outputError.
419 *
420 * The configuration properties are all functions:
421 * ```
422 * // functions to change where being written, stdout and stderr
423 * writeOut(str)
424 * writeErr(str)
425 * // matching functions to specify width for wrapping help
426 * getOutHelpWidth()
427 * getErrHelpWidth()
428 * // functions based on what is being written out
429 * outputError(str, write) // used for displaying errors, and not used for displaying help
430 * ```
431 */
432 configureOutput(configuration: OutputConfiguration): this;
433 /** Get configuration */
434 configureOutput(): OutputConfiguration;
435
436 /**
437 * Copy settings that are useful to have in common across root command and subcommands.
438 *
439 * (Used internally when adding a command using `.command()` so subcommands inherit parent settings.)
440 */
441 copyInheritedSettings(sourceCommand: Command): this;
442
443 /**
444 * Display the help or a custom message after an error occurs.
445 */
446 showHelpAfterError(displayHelp?: boolean | string): this;
447
448 /**
449 * Display suggestion of similar commands for unknown commands, or options for unknown options.
450 */
451 showSuggestionAfterError(displaySuggestion?: boolean): this;
452
453 /**
454 * Register callback `fn` for the command.
455 *
456 * @example
457 * ```
458 * program
459 * .command('serve')
460 * .description('start service')
461 * .action(function() {
462 * // do work here
463 * });
464 * ```
465 *
466 * @returns `this` command for chaining
467 */
468 action(fn: (...args: any[]) => void | Promise<void>): this;
469
470 /**
471 * Define option with `flags`, `description` and optional
472 * coercion `fn`.
473 *
474 * The `flags` string contains the short and/or long flags,
475 * separated by comma, a pipe or space. The following are all valid
476 * all will output this way when `--help` is used.
477 *
478 * "-p, --pepper"
479 * "-p|--pepper"
480 * "-p --pepper"
481 *
482 * @example
483 * ```
484 * // simple boolean defaulting to false
485 * program.option('-p, --pepper', 'add pepper');
486 *
487 * --pepper
488 * program.pepper
489 * // => Boolean
490 *
491 * // simple boolean defaulting to true
492 * program.option('-C, --no-cheese', 'remove cheese');
493 *
494 * program.cheese
495 * // => true
496 *
497 * --no-cheese
498 * program.cheese
499 * // => false
500 *
501 * // required argument
502 * program.option('-C, --chdir <path>', 'change the working directory');
503 *
504 * --chdir /tmp
505 * program.chdir
506 * // => "/tmp"
507 *
508 * // optional argument
509 * program.option('-c, --cheese [type]', 'add cheese [marble]');
510 * ```
511 *
512 * @returns `this` command for chaining
513 */
514 option(flags: string, description?: string, defaultValue?: string | boolean): this;
515 option<T>(flags: string, description: string, fn: (value: string, previous: T) => T, defaultValue?: T): this;
516 /** @deprecated since v7, instead use choices or a custom function */
517 option(flags: string, description: string, regexp: RegExp, defaultValue?: string | boolean): this;
518
519 /**
520 * Define a required option, which must have a value after parsing. This usually means
521 * the option must be specified on the command line. (Otherwise the same as .option().)
522 *
523 * The `flags` string contains the short and/or long flags, separated by comma, a pipe or space.
524 */
525 requiredOption(flags: string, description?: string, defaultValue?: string | boolean): this;
526 requiredOption<T>(flags: string, description: string, fn: (value: string, previous: T) => T, defaultValue?: T): this;
527 /** @deprecated since v7, instead use choices or a custom function */
528 requiredOption(flags: string, description: string, regexp: RegExp, defaultValue?: string | boolean): this;
529
530 /**
531 * Factory routine to create a new unattached option.
532 *
533 * See .option() for creating an attached option, which uses this routine to
534 * create the option. You can override createOption to return a custom option.
535 */
536
537 createOption(flags: string, description?: string): Option;
538
539 /**
540 * Add a prepared Option.
541 *
542 * See .option() and .requiredOption() for creating and attaching an option in a single call.
543 */
544 addOption(option: Option): this;
545
546 /**
547 * Whether to store option values as properties on command object,
548 * or store separately (specify false). In both cases the option values can be accessed using .opts().
549 *
550 * @returns `this` command for chaining
551 */
552 storeOptionsAsProperties<T extends OptionValues>(): this & T;
553 storeOptionsAsProperties<T extends OptionValues>(storeAsProperties: true): this & T;
554 storeOptionsAsProperties(storeAsProperties?: boolean): this;
555
556 /**
557 * Retrieve option value.
558 */
559 getOptionValue(key: string): any;
560
561 /**
562 * Store option value.
563 */
564 setOptionValue(key: string, value: unknown): this;
565
566 /**
567 * Store option value and where the value came from.
568 */
569 setOptionValueWithSource(key: string, value: unknown, source: OptionValueSource): this;
570
571 /**
572 * Retrieve option value source.
573 */
574 getOptionValueSource(key: string): OptionValueSource;
575
576 /**
577 * Alter parsing of short flags with optional values.
578 *
579 * @example
580 * ```
581 * // for `.option('-f,--flag [value]'):
582 * .combineFlagAndOptionalValue(true) // `-f80` is treated like `--flag=80`, this is the default behaviour
583 * .combineFlagAndOptionalValue(false) // `-fb` is treated like `-f -b`
584 * ```
585 *
586 * @returns `this` command for chaining
587 */
588 combineFlagAndOptionalValue(combine?: boolean): this;
589
590 /**
591 * Allow unknown options on the command line.
592 *
593 * @returns `this` command for chaining
594 */
595 allowUnknownOption(allowUnknown?: boolean): this;
596
597 /**
598 * Allow excess command-arguments on the command line. Pass false to make excess arguments an error.
599 *
600 * @returns `this` command for chaining
601 */
602 allowExcessArguments(allowExcess?: boolean): this;
603
604 /**
605 * Enable positional options. Positional means global options are specified before subcommands which lets
606 * subcommands reuse the same option names, and also enables subcommands to turn on passThroughOptions.
607 *
608 * The default behaviour is non-positional and global options may appear anywhere on the command line.
609 *
610 * @returns `this` command for chaining
611 */
612 enablePositionalOptions(positional?: boolean): this;
613
614 /**
615 * Pass through options that come after command-arguments rather than treat them as command-options,
616 * so actual command-options come before command-arguments. Turning this on for a subcommand requires
617 * positional options to have been enabled on the program (parent commands).
618 *
619 * The default behaviour is non-positional and options may appear before or after command-arguments.
620 *
621 * @returns `this` command for chaining
622 */
623 passThroughOptions(passThrough?: boolean): this;
624
625 /**
626 * Parse `argv`, setting options and invoking commands when defined.
627 *
628 * The default expectation is that the arguments are from node and have the application as argv[0]
629 * and the script being run in argv[1], with user parameters after that.
630 *
631 * @example
632 * ```
633 * program.parse(process.argv);
634 * program.parse(); // implicitly use process.argv and auto-detect node vs electron conventions
635 * program.parse(my-args, { from: 'user' }); // just user supplied arguments, nothing special about argv[0]
636 * ```
637 *
638 * @returns `this` command for chaining
639 */
640 parse(argv?: readonly string[], options?: ParseOptions): this;
641
642 /**
643 * Parse `argv`, setting options and invoking commands when defined.
644 *
645 * Use parseAsync instead of parse if any of your action handlers are async. Returns a Promise.
646 *
647 * The default expectation is that the arguments are from node and have the application as argv[0]
648 * and the script being run in argv[1], with user parameters after that.
649 *
650 * @example
651 * ```
652 * program.parseAsync(process.argv);
653 * program.parseAsync(); // implicitly use process.argv and auto-detect node vs electron conventions
654 * program.parseAsync(my-args, { from: 'user' }); // just user supplied arguments, nothing special about argv[0]
655 * ```
656 *
657 * @returns Promise
658 */
659 parseAsync(argv?: readonly string[], options?: ParseOptions): Promise<this>;
660
661 /**
662 * Parse options from `argv` removing known options,
663 * and return argv split into operands and unknown arguments.
664 *
665 * argv => operands, unknown
666 * --known kkk op => [op], []
667 * op --known kkk => [op], []
668 * sub --unknown uuu op => [sub], [--unknown uuu op]
669 * sub -- --unknown uuu op => [sub --unknown uuu op], []
670 */
671 parseOptions(argv: string[]): ParseOptionsResult;
672
673 /**
674 * Return an object containing local option values as key-value pairs
675 */
676 opts<T extends OptionValues>(): T;
677
678 /**
679 * Return an object containing merged local and global option values as key-value pairs.
680 */
681 optsWithGlobals<T extends OptionValues>(): T;
682
683 /**
684 * Set the description.
685 *
686 * @returns `this` command for chaining
687 */
688
689 description(str: string): this;
690 /** @deprecated since v8, instead use .argument to add command argument with description */
691 description(str: string, argsDescription: {[argName: string]: string}): this;
692 /**
693 * Get the description.
694 */
695 description(): string;
696
697 /**
698 * Set an alias for the command.
699 *
700 * You may call more than once to add multiple aliases. Only the first alias is shown in the auto-generated help.
701 *
702 * @returns `this` command for chaining
703 */
704 alias(alias: string): this;
705 /**
706 * Get alias for the command.
707 */
708 alias(): string;
709
710 /**
711 * Set aliases for the command.
712 *
713 * Only the first alias is shown in the auto-generated help.
714 *
715 * @returns `this` command for chaining
716 */
717 aliases(aliases: readonly string[]): this;
718 /**
719 * Get aliases for the command.
720 */
721 aliases(): string[];
722
723 /**
724 * Set the command usage.
725 *
726 * @returns `this` command for chaining
727 */
728 usage(str: string): this;
729 /**
730 * Get the command usage.
731 */
732 usage(): string;
733
734 /**
735 * Set the name of the command.
736 *
737 * @returns `this` command for chaining
738 */
739 name(str: string): this;
740 /**
741 * Get the name of the command.
742 */
743 name(): string;
744
745 /**
746 * Set the name of the command from script filename, such as process.argv[1],
747 * or require.main.filename, or __filename.
748 *
749 * (Used internally and public although not documented in README.)
750 *
751 * @example
752 * ```ts
753 * program.nameFromFilename(require.main.filename);
754 * ```
755 *
756 * @returns `this` command for chaining
757 */
758 nameFromFilename(filename: string): this;
759
760 /**
761 * Set the directory for searching for executable subcommands of this command.
762 *
763 * @example
764 * ```ts
765 * program.executableDir(__dirname);
766 * // or
767 * program.executableDir('subcommands');
768 * ```
769 *
770 * @returns `this` command for chaining
771 */
772 executableDir(path: string): this;
773 /**
774 * Get the executable search directory.
775 */
776 executableDir(): string;
777
778 /**
779 * Output help information for this command.
780 *
781 * Outputs built-in help, and custom text added using `.addHelpText()`.
782 *
783 */
784 outputHelp(context?: HelpContext): void;
785 /** @deprecated since v7 */
786 outputHelp(cb?: (str: string) => string): void;
787
788 /**
789 * Return command help documentation.
790 */
791 helpInformation(context?: HelpContext): string;
792
793 /**
794 * You can pass in flags and a description to override the help
795 * flags and help description for your command. Pass in false
796 * to disable the built-in help option.
797 */
798 helpOption(flags?: string | boolean, description?: string): this;
799
800 /**
801 * Output help information and exit.
802 *
803 * Outputs built-in help, and custom text added using `.addHelpText()`.
804 */
805 help(context?: HelpContext): never;
806 /** @deprecated since v7 */
807 help(cb?: (str: string) => string): never;
808
809 /**
810 * Add additional text to be displayed with the built-in help.
811 *
812 * Position is 'before' or 'after' to affect just this command,
813 * and 'beforeAll' or 'afterAll' to affect this command and all its subcommands.
814 */
815 addHelpText(position: AddHelpTextPosition, text: string): this;
816 addHelpText(position: AddHelpTextPosition, text: (context: AddHelpTextContext) => string): this;
817
818 /**
819 * Add a listener (callback) for when events occur. (Implemented using EventEmitter.)
820 */
821 on(event: string | symbol, listener: (...args: any[]) => void): this;
822}
823
824export interface CommandOptions {
825 hidden?: boolean;
826 isDefault?: boolean;
827 /** @deprecated since v7, replaced by hidden */
828 noHelp?: boolean;
829}
830export interface ExecutableCommandOptions extends CommandOptions {
831 executableFile?: string;
832}
833
834export interface ParseOptionsResult {
835 operands: string[];
836 unknown: string[];
837}
838
839export function createCommand(name?: string): Command;
840export function createOption(flags: string, description?: string): Option;
841export function createArgument(name: string, description?: string): Argument;
842
843export const program: Command;
844
\No newline at end of file