import { Container, interfaces } from 'inversify'; import { PrettyOptions } from 'pino-pretty'; import { Constructor } from 'type-fest'; import { Argument } from './base/Argument.js'; import { Option as Option$1, Help as Help$1, Command as Command$1, Argument as Argument$1, ParseOptions, OptionValues } from 'commander'; import { Debug } from 'debug'; import { Logger, Level } from 'pino'; import { ColorInstance } from './utils/color.js'; import CliTable3 from 'cli-table3'; import { Input } from './helpers/Input.js'; import { a as Output } from './Output-B6UXHbGv.js'; import { Cache } from './Cache.js'; import { StartFn } from './types/index.js'; import { Macroable } from './utils/macroable.js'; import { PackageJson } from './utils/packageJSON.js'; import { ApplicationBindings } from './types/app.js'; import { OutputMacros, InputMacros } from './types/output.js'; import { Path, Paths } from './types/path.js'; import { Logger as Logger$1, LoggerOptions } from './types/log.js'; import { ExitCode } from './types/ExitCode.js'; type OptionCallback = (value: any, option: Option, command: Command, app: App) => void; interface OptionConstructor { new (flags: string, description?: string): Option; (flags: string, description?: string): Option; prototype: Option; } declare class Option extends Option$1 { Base: typeof Option$1; _global: boolean; _callback: OptionCallback; constructor(flags: string, description?: string); callback(): OptionCallback; callback(val: OptionCallback): this; global(): boolean; global(global: boolean): this; arity(): 0 | 1; } declare namespace Option { type Option = Option$1; } interface HelpConstructor { new (): Help; (): Help; prototype: Help; } type HelpConfiguration = Partial & Partial; type HelpGroup = 'Usage' | 'CommandDescription' | 'CommandsList' | 'ArgumentsList' | 'OptionsList' | 'GlobalOptionsList'; type HelpOutputOrder = Partial>; /** * The `Help` class extends the base help functionality provided by `commander`. * It customizes the display of command-line help, including options, arguments, and commands. * This class supports additional formatting and styling options for better readability. * * @example * const help = new Help(); * help.seperateOptionsByNewLine = true; * help.useExtraInfoColumn = true; * const output = help.formatHelp(command, help); * console.log(output); */ declare class Help extends Help$1 { static Application?: App; get app(): App; get in(): Input; get out(): Output; /** @see https://github.com/chalk/chalk */ protected color: ColorInstance; /** @see https://github.com/chalk/chalk-template */ protected c: TemplateStringsArray; seperateOptionsByNewLine: boolean; seperateGlobalOptionsByNewLine: boolean; useImprovedHelp: boolean; outputOrder: HelpOutputOrder; constructor(); /** * Calculates the display width of a string, excluding ANSI escape codes. * * @param {string} str - The string to measure. * @returns {number} The display width of the string. */ displayWidth(str: string): number; /** * Wraps a string to a specified width, preserving words. * * @param {string} str - The string to wrap. * @param {number} width - The maximum width of the wrapped string. * @returns {string} The wrapped string. */ boxWrap(str: string, width: number): string; /** * Styles a title string. * * @param {string} str - The title string to style. * @returns {string} The styled title string. */ styleTitle(str: string): string; styleSubcommandTerm(str: string): string; /** * Styles a command text string. * * @param {string} str - The command text string to style. * @returns {string} The styled command text string. */ styleCommandText(str: string): string; /** * Styles a command description string. * * @param {string} str - The command description string to style. * @returns {string} The styled command description string. */ styleCommandDescription(str: string): string; /** * Styles a subcommand description string. * * @param {string} str - The subcommand description string to style. * @returns {string} The styled subcommand description string. */ styleSubcommandDescription(str: string): string; /** * Styles a description text string. * * @param {string} str - The description text string to style. * @returns {string} The styled description text string. */ styleDescriptionText(str: string): string; /** * Styles an option text string. * * @param {string} str - The option text string to style. * @returns {string} The styled option text string. */ styleOptionText(str: string): string; /** * Styles an argument text string. * * @param {string} str - The argument text string to style. * @returns {string} The styled argument text string. */ styleArgumentText(str: string): string; /** * Styles a subcommand text string. * * @param {string} str - The subcommand text string to style. * @returns {string} The styled subcommand text string. */ styleSubcommandText(str: string): string; /** * Styles an option description string. * * @param {string} str - The option description string to style. * @returns {string} The styled option description string. */ styleOptionDescription(str: string): string; /** * Styles an argument description string. * * @param {string} str - The argument description string to style. * @returns {string} The styled argument description string. */ styleArgumentDescription(str: string): string; /** * Returns the term for an option, with additional styling. * * @param {Option} option - The option to get the term for. * @returns {string} The styled option term. */ optionTerm(option: Option): string; /** * Prepares the context for displaying help. * * @param {object} contextOptions - The context options. */ prepareContext(contextOptions: object): void; /** * Returns the visible global options for a command. * * @param {Command} _cmd - The command to get the global options for. * @returns {Option[]} The visible global options. */ visibleGlobalOptions(_cmd: Command): Option[]; /** * Styles the usage string for a command. * * @param {string} str - The usage string to style. * @returns {string} The styled usage string. */ styleUsage(str: string): string; /** * Returns the description for an option. * * @param {Option} option - The option to get the description for. * @returns {string} The option description. */ optionDescription(option: Option): string; /** * Returns the description for an argument. * * @param {Argument} argument - The argument to get the description for. * @returns {string} The argument description. */ argumentDescription(argument: Argument): string; /** * Formats the help for a command. * * @param {Command} cmd - The command to format the help for. * @param {Help} helper - The help instance. * @returns {string} The formatted help string. */ formatHelp(cmd: Command, helper: this): string; /** * Converts a value to a string and optionally colors it. * * @param {any} value - The value to stringify. * @param {boolean} [color=true] - Whether to color the stringified value. * @returns {string} The stringified value. */ protected stringifyValue(value: any, color?: boolean): string; protected subcommandExtraColumn(command: Command): string; /** * Returns the extra column information for an argument. * * @param {Argument} argument - The argument to get the extra column information for. * @returns {string} The extra column information. */ protected argumentExtraColumn(argument: Argument): string; /** * Returns the extra column information for an option. * * @param {Option} option - The option to get the extra column information for. * @returns {string} The extra column information. */ protected optionExtraColumn(option: Option): string; /** * Creates a table from the provided rows and options. * * @param {any[]} rows - The rows to include in the table. * @param {CliTable3.TableConstructorOptions} [options={}] - The table options. * @returns {string} The formatted table string. */ protected table(rows: any[], options?: CliTable3.TableConstructorOptions): string; /** * Transforms the option list for display. * * @param {Help} helper - The help instance. * @param {boolean} seperateByNewLine - Whether to separate options by new lines. * @param {Option[]} options - The options to transform. * @returns {any[]} The transformed option list. */ protected transformOptionList(helper: this, seperateByNewLine: boolean, options: Option[]): any[]; /** * Formats the help with an extra column for additional information. * * @param {Command} cmd - The command to format the help for. * @param {Help} helper - The help instance. * @returns {string} The formatted help string. */ protected formatHelpImproved(cmd: Command, helper: this): string; } declare namespace Help { type Help = Help$1; } declare class BaseCommand extends Command$1 { emit: (event: string | symbol, ...args: any[]) => boolean; listen: (event: string | symbol, listener: (...args: any[]) => void) => this; protected _executableFile?: string; protected _name?: string; protected _executableHandler: boolean; parent: Command; _helpConfiguration: HelpConfiguration; commands: Command[]; options: Option[]; registeredArguments: Argument$1[]; _allowUnknownOption?: any; _allowExcessArguments?: any; _args?: any; _scriptPath?: any; _optionValues?: any; _optionValueSources?: any; _storeOptionsAsProperties?: any; _actionHandler?: any; _executableDir?: any; _defaultCommandName?: any; _exitCallback?: any; _aliases?: any; _savedState?: any; static Application?: App; get app(): App; get in(): Input; get out(): Output; get log(): Logger; protected _debug?: Debug; } declare class GlobalOptionsCommand extends BaseCommand { static Application?: App; get app(): App; constructor(); createOption(flags: string, description: string, defaultValue?: any): Option; addOption(option: Option): this; opts(): T; clearOptions(): this; handleOptionsCallback(opts: any): any; removeOption(_option: string | Option): this; add(flags: Usage, description: string, defaultValue: T): Option; } declare class Command extends BaseCommand { constructor(name?: string); examples(): string; examples(examples: string | string[]): this; /** * Commander was never meant to load subcommands as modules. * Commander runs subcommands as child processes * * So this way is abit of hacky way to load a subcommand as a module */ getExecutableFileCommand(): Promise; importAllExecutableSubCommands(inheritSettings?: boolean, inheritGlobalOptions?: boolean): Promise; protected findCommandPath(name: string): string; /** @return {Command} Returns instance of subcommand */ addSubCommand(name: string): this; /** @return {Command} Returns the current command for chaining */ addSubCommand(name: string, description: string, _arguments?: string): this; executableDir(): string; executableDir(executableDir: string): this; executableFile(): string; executableFile(executableFile: string): this; globalOptions: Option$1[]; protected _addGlobalOption(option: Option$1): void; protected rawArgs: string[]; _globalOptionsCommand: GlobalOptionsCommand; removeOption(option: string | Option$1): this; updateGlobalOptions(): this; setGlobalOptionsCommand(cmd: GlobalOptionsCommand): this; opts(): T; handleOptionsCallback(opts: any): any; _outputHelpIfRequested(args: any): void; /** @return Returns instance of subcommand */ parse(argv?: readonly string[], parseOptions?: ParseOptions): this; parseAsync(argv?: readonly string[], parseOptions?: ParseOptions): Promise; createArgument(name: string, description?: string): Argument$1; createOption(flags: string, description?: string): Option$1; createCommand(name?: string): Command; createHelp(): Help; configureHelp(): HelpConfiguration; configureHelp(configuration: HelpConfiguration): this; action(fn: (this: this, ...args: any[]) => void | Promise): this; protected _examples?: string; } interface GlobalOptionsValues extends OptionValues { [key: string]: any; verbose: boolean; logLevel: Level; silent: boolean; color: boolean; debug: boolean; interaction: boolean; } declare const gopts: GlobalOptionsCommand; declare const parseGopts: () => GlobalOptionsValues; /** * The `Application` class serves as the main entry point for the command-line application. * It provides static methods and properties to create and manage commands, options, arguments, and help documentation. * * @example * // Initialize the application * Application.init(); * * // Create a new command * const myCommand = Application.createCommand('myCommand'); * myCommand.description('This is my custom command'); * * // Add an option to the command * const myOption = Application.createOption('-f, --flag', 'A custom flag'); * myCommand.addOption(myOption); * * // Add an argument to the command * const myArgument = Application.createArgument('', 'A custom argument'); * myCommand.addArgument(myArgument); * * // Add the command to the program * Application.program.addCommand(myCommand); * * // Parse the command-line arguments * Application.program.parse(process.argv); */ declare class Application { static globalOptions?: GlobalOptionsValues; static container: Container; static get(serviceIdentifier: interfaces.ServiceIdentifier): T; static has(serviceIdentifier: interfaces.ServiceIdentifier): boolean; static set(serviceIdentifier: interfaces.ServiceIdentifier): interfaces.BindingToSyntax; static set(serviceIdentifier: interfaces.ServiceIdentifier, value: interfaces.DynamicValue): interfaces.BindingInWhenOnSyntax; static set(serviceIdentifier: interfaces.ServiceIdentifier, value: T): interfaces.BindingToSyntax; /** * Constructor for the `Help` class. */ static Help: Constructor; /** * Constructor for the `Command` class. */ static Command: Constructor; static GlobalOptionsCommand: Constructor; /** * Constructor for the `Option` class. */ static Option: Constructor