UNPKG

774 BJavaScriptView Raw
1"use strict";
2Object.defineProperty(exports, "__esModule", { value: true });
3class IncompatibleHelpError extends Error {
4 constructor() {
5 super(...arguments);
6 this.message = 'Please implement `formatCommand` in your custom help class.\nSee https://oclif.io/docs/help_classes for more.';
7 }
8}
9class HelpCompatibilityWrapper {
10 constructor(inner) {
11 this.inner = inner;
12 }
13 formatCommand(command) {
14 if (this.inner.formatCommand) {
15 return this.inner.formatCommand(command);
16 }
17 if (this.inner.command) {
18 return command.description + '\n\n' + this.inner.command(command);
19 }
20 throw new IncompatibleHelpError();
21 }
22}
23exports.HelpCompatibilityWrapper = HelpCompatibilityWrapper;