From 4351759dc4309fa22eefd5536daa4dd6fc6f4366 Mon Sep 17 00:00:00 2001 From: RasPhilCo Date: Wed, 16 Sep 2020 12:43:35 -0500 Subject: [PATCH] feat: export HelpOptions in Interfaces --- src/help/index.ts | 12 +++--------- src/interfaces/help.ts | 5 +++++ src/interfaces/index.ts | 1 + 3 files changed, 9 insertions(+), 9 deletions(-) create mode 100644 src/interfaces/help.ts diff --git a/src/help/index.ts b/src/help/index.ts index 386b39a51..b667bc0a9 100644 --- a/src/help/index.ts +++ b/src/help/index.ts @@ -20,12 +20,6 @@ const { const ROOT_INDEX_CMD_ID = '' -export interface HelpOptions { - all?: boolean; - maxWidth: number; - stripAnsi?: boolean; -} - function getHelpSubject(args: string[]): string | undefined { for (const arg of args) { if (arg === '--') return @@ -36,14 +30,14 @@ function getHelpSubject(args: string[]): string | undefined { } export abstract class HelpBase { - constructor(config: Interfaces.Config, opts: Partial = {}) { + constructor(config: Interfaces.Config, opts: Partial = {}) { this.config = config this.opts = {maxWidth: stdtermwidth, ...opts} } protected config: Interfaces.Config - protected opts: HelpOptions + protected opts: Interfaces.HelpOptions /** * Show help, used in multi-command CLIs @@ -95,7 +89,7 @@ export class Help extends HelpBase { return topics } - constructor(config: Interfaces.Config, opts: Partial = {}) { + constructor(config: Interfaces.Config, opts: Partial = {}) { super(config, opts) this.render = template(this) } diff --git a/src/interfaces/help.ts b/src/interfaces/help.ts new file mode 100644 index 000000000..07cc5d161 --- /dev/null +++ b/src/interfaces/help.ts @@ -0,0 +1,5 @@ +export interface HelpOptions { + all?: boolean; + maxWidth: number; + stripAnsi?: boolean; +} diff --git a/src/interfaces/index.ts b/src/interfaces/index.ts index 1aebac214..c9e3bf49f 100644 --- a/src/interfaces/index.ts +++ b/src/interfaces/index.ts @@ -1,5 +1,6 @@ export {Config, ArchTypes, PlatformTypes, LoadOptions} from './config' export {Command} from './command' +export {HelpOptions} from './help' export {Hook, HookKeyOrOptions, Hooks} from './hooks' export {Manifest} from './manifest' export {PJSON} from './pjson'