import { CommandMetadata, CommandMetadataInput, CommandMetadataOption, Footnote, HydratedCommandMetadata, HydratedNamespaceMetadata, ICommand, INamespace, NamespaceLocateResult, NamespaceMetadata } from '../definitions'; import { Colors } from './colors'; export declare function isOptionVisible(opt: O): Promise; export declare function isCommandVisible, N extends INamespace, M extends CommandMetadata, I extends CommandMetadataInput, O extends CommandMetadataOption>(cmd: HydratedCommandMetadata): Promise; export declare abstract class HelpFormatter { protected readonly colors: Colors; constructor({ colors }: { colors?: Colors; }); abstract format(): Promise; } export interface NamespaceHelpFormatterDeps, N extends INamespace, M extends CommandMetadata, I extends CommandMetadataInput, O extends CommandMetadataOption> { readonly location: NamespaceLocateResult; readonly namespace: N; readonly colors?: Colors; } export declare abstract class NamespaceHelpFormatter, N extends INamespace, M extends CommandMetadata, I extends CommandMetadataInput, O extends CommandMetadataOption> extends HelpFormatter { protected readonly location: NamespaceLocateResult; protected readonly namespace: N; protected readonly dotswidth: number; protected _metadata?: NamespaceMetadata; protected _fullName?: string; constructor({ location, namespace, colors }: NamespaceHelpFormatterDeps); protected normalizeMetadata(metadata: NamespaceMetadata): NamespaceMetadata; protected normalizeCommandMetadata(metadata: HydratedCommandMetadata): HydratedCommandMetadata; /** * Given command metadata, decide whether to keep or discard the command that * the metadata represents. * * @param meta: The metadata of the command. * @return `true` to keep, `false` to discard */ filterCommandCallback(meta: HydratedCommandMetadata): Promise; getNamespaceMetadata(): Promise; getCommandMetadataList(): Promise[]>; getNamespaceFullName(): Promise; } export declare class NamespaceStringHelpFormatter, N extends INamespace, M extends CommandMetadata, I extends CommandMetadataInput, O extends CommandMetadataOption> extends NamespaceHelpFormatter { formatHeader(): Promise; formatSummary(): Promise; formatDescription(): Promise; getGlobalOptions(): Promise; formatUsage(): Promise; formatCommands(): Promise; formatCommandGroup(titleText: string, commands: readonly HydratedCommandMetadata[]): Promise; getListOfCommandDetails(commands: readonly HydratedCommandMetadata[]): Promise; getListOfNamespaceDetails(commands: readonly HydratedCommandMetadata[]): Promise; /** * Insert text before the namespace's summary. * * @param meta: The metadata of the namespace. */ formatBeforeSummary(meta: NamespaceMetadata): Promise; /** * Insert text after the namespace's summary. * * @param meta: The metadata of the namespace. */ formatAfterSummary(meta: NamespaceMetadata): Promise; /** * Insert text that appears before a commands's summary. * * @param meta: The metadata of the command. */ formatBeforeCommandSummary(meta: HydratedCommandMetadata): Promise; /** * Insert text that appears after a commands's summary. * * @param meta: The metadata of the command. */ formatAfterCommandSummary(meta: HydratedCommandMetadata): Promise; /** * Insert text that appears before a namespace's summary. * * @param meta The metadata of the namespace. * @param commands An array of the metadata of the namespace's commands. */ formatBeforeNamespaceSummary(meta: HydratedNamespaceMetadata, commands: readonly HydratedCommandMetadata[]): Promise; /** * Insert text that appears after a namespace's summary. * * @param meta The metadata of the namespace. * @param commands An array of the metadata of the namespace's commands. */ formatAfterNamespaceSummary(meta: HydratedNamespaceMetadata, commands: readonly HydratedCommandMetadata[]): Promise; format(): Promise; } export interface CommandHelpFormatterDeps, N extends INamespace, M extends CommandMetadata, I extends CommandMetadataInput, O extends CommandMetadataOption> { readonly location: NamespaceLocateResult; readonly command: C; /** * Provide extra context with hydrated command metadata. If not provided, * `command.getMetadata()` is called. */ readonly metadata?: HydratedCommandMetadata; readonly colors?: Colors; } export declare abstract class CommandHelpFormatter, N extends INamespace, M extends CommandMetadata, I extends CommandMetadataInput, O extends CommandMetadataOption> extends HelpFormatter { protected readonly location: NamespaceLocateResult; protected readonly command: C; protected readonly dotswidth: number; protected _metadata?: M; protected _fullName?: string; constructor({ location, command, metadata, colors }: CommandHelpFormatterDeps); protected normalizeMetadata(metadata: M | HydratedCommandMetadata): M; /** * Given an option definition from command metadata, decide whether to keep * or discard it. * * @return `true` to keep, `false` to discard */ filterOptionCallback(option: O): Promise; getCommandMetadata(): Promise>; getCommandFullName(): Promise; } export declare class CommandStringHelpFormatter, N extends INamespace, M extends CommandMetadata, I extends CommandMetadataInput, O extends CommandMetadataOption> extends CommandHelpFormatter { formatHeader(): Promise; formatSummary(): Promise; formatDescription(): Promise; formatInlineInput(input: I): Promise; formatUsage(): Promise; formatInputs(): Promise; formatOptionLine(opt: O): Promise; /** * Insert text before the command's summary. * * @param meta The metadata of the command. */ formatBeforeSummary(meta: M): Promise; /** * Insert text after the command's summary. * * @param meta The metadata of the command. */ formatAfterSummary(meta: M): Promise; /** * Insert text that appears before an option's summary. * * @param opt The metadata of the option. */ formatBeforeOptionSummary(opt: O): Promise; formatAfterOptionSummary(opt: O): Promise; formatOptionDefault(opt: O): Promise; formatOptions(): Promise; formatOptionsGroup(titleText: string, options: O[]): Promise; formatExamples(): Promise; format(): Promise; } export interface NamespaceHelpSchema { readonly name: string; readonly summary: string; readonly description: string; readonly groups: readonly string[]; readonly commands: CommandHelpSchema[]; readonly aliases: readonly string[]; } export declare class NamespaceSchemaHelpFormatter, N extends INamespace, M extends CommandMetadata, I extends CommandMetadataInput, O extends CommandMetadataOption> extends NamespaceHelpFormatter { format(): Promise; serialize(): Promise; formatCommandGroup(commands: readonly HydratedCommandMetadata[]): Promise; formatCommand(cmd: HydratedCommandMetadata): Promise; } export interface CommandHelpSchemaInput { readonly name: string; readonly summary: string; readonly required: boolean; } export interface CommandHelpSchemaOption { readonly name: string; readonly summary: string; readonly groups: readonly string[]; readonly aliases: readonly string[]; readonly type: string; readonly default?: string | boolean; readonly spec: { readonly value: string; }; } export interface CommandHelpSchemaFootnoteText { readonly type: 'text'; readonly id: string | number; readonly text: string; } export interface CommandHelpSchemaFootnoteLink { readonly type: 'link'; readonly id: string | number; readonly url: string; readonly shortUrl?: string; } export declare type CommandHelpSchemaFootnote = CommandHelpSchemaFootnoteText | CommandHelpSchemaFootnoteLink; export interface CommandHelpSchema { readonly name: string; readonly namespace: readonly string[]; readonly summary: string; readonly description: string; readonly footnotes: readonly CommandHelpSchemaFootnote[]; readonly groups: readonly string[]; readonly exampleCommands: readonly string[]; readonly aliases: readonly string[]; readonly inputs: readonly CommandHelpSchemaInput[]; readonly options: readonly CommandHelpSchemaOption[]; } export declare class CommandSchemaHelpFormatter, N extends INamespace, M extends CommandMetadata, I extends CommandMetadataInput, O extends CommandMetadataOption> extends CommandHelpFormatter { format(): Promise; serialize(): Promise; formatInputs(inputs: readonly I[]): Promise; formatInput(input: I): Promise; formatOptions(options: readonly O[]): Promise; formatOption(option: O): Promise; formatFootnote(footnote: Footnote): CommandHelpSchemaFootnote; formatCommand(cmd: M | HydratedCommandMetadata): Promise; } export declare function createCommandMetadataFromSchema(schema: CommandHelpSchema): Required;