@clerc/plugin-help
Version:
Clerc plugin help
71 lines (67 loc) • 1.63 kB
TypeScript
import * as _clerc_core from '@clerc/core';
interface BlockSection {
type?: "block";
title: string;
body: string[];
}
interface InlineSection {
type: "inline";
items: {
title: string;
body: string;
}[];
}
type Section = BlockSection | InlineSection;
interface Renderers {
renderSections?: (sections: Section[]) => Section[];
renderFlagName?: (name: string) => string;
renderType?: (type: any, hasDefault: boolean) => string;
renderDefault?: (default_: any) => string;
}
declare module "@clerc/core" {
interface CommandCustomProperties {
help?: {
renderers?: Renderers;
examples?: [string, string][];
notes?: string[];
};
}
}
interface HelpPluginOptions {
/**
* Whether to register the help command.
*
* @default true
*/
command?: boolean;
/**
* Whether to register the global help flag.
*
* @default true
*/
flag?: boolean;
/**
* Whether to show help when no command is specified.
*
* @default true
*/
showHelpWhenNoCommand?: boolean;
/**
* Global notes.
*/
notes?: string[];
/**
* Global examples.
*/
examples?: [string, string][];
/**
* Banner.
*/
banner?: string;
/**
* Renderers.
*/
renderers?: Renderers;
}
declare const helpPlugin: ({ command, flag, showHelpWhenNoCommand, notes, examples, banner, renderers, }?: HelpPluginOptions) => _clerc_core.Plugin<_clerc_core.Clerc<{}, {}>, _clerc_core.Clerc<{}, {}>>;
export { HelpPluginOptions, helpPlugin };