UNPKG

retroload

Version:

Command line utility for converting tape archive files of historical computers into sound for loading them on real devices

31 lines 1.3 kB
import { Help } from 'commander'; export class CustomHelp extends Help { constructor(adapters) { super(); Object.defineProperty(this, "adapters", { enumerable: true, configurable: true, writable: true, value: adapters }); } formatHelp(cmd, helper) { let output = super.formatHelp(cmd, helper); const adaptersSorted = this.adapters.sort((a, b) => a.label.localeCompare(b.label)); const adapterList = adaptersSorted.map((adapter) => { const adapterOptionsSorted = adapter.options.sort((a, b) => a.name.localeCompare(b.name)); const adapterOptions = adapterOptionsSorted.map((option) => helper.formatItem(` --${option.name}`, 20, option.description, helper)); let adapterDetails = ` ${adapter.label} (${adapter.name})`; if (adapterOptions.length > 0) { adapterDetails += `\n\n${adapterOptions.join('\n')}`; } adapterDetails += '\n'; return adapterDetails; }); if (adapterList.length > 0) { output = `${output}\nSupported formats and their specific options:\n\n${adapterList.join('\n')}\n`; } return output; } } //# sourceMappingURL=CustomHelp.js.map