UNPKG

solidity-docgen

Version:

Solidity API documentation automatic generator.

79 lines 2.75 kB
#!/usr/bin/env node "use strict"; var __importDefault = (this && this.__importDefault) || function (mod) { return (mod && mod.__esModule) ? mod : { "default": mod }; }; Object.defineProperty(exports, "__esModule", { value: true }); exports.Docgen = void 0; const command_1 = require("@oclif/command"); const path_1 = __importDefault(require("path")); const json5_1 = __importDefault(require("json5")); const docgen_1 = require("./docgen"); const sitemap_1 = require("./sitemap"); class Docgen extends command_1.Command { async run() { const { flags } = this.parse(Docgen); await docgen_1.docgen(flags); } } exports.Docgen = Docgen; Docgen.flags = { version: command_1.flags.version(), help: command_1.flags.help(), input: command_1.flags.string({ char: 'i', default: 'contracts', description: 'directory where contracts will be taken from', }), output: command_1.flags.string({ char: 'o', default: 'docs', description: 'directory where generated docs will be written', }), exclude: command_1.flags.build({ parse: s => s.split(','), })({ char: 'e', description: 'exclude directories that match the pattern (separated by commas)', }), templates: command_1.flags.string({ char: 't', parse: s => path_1.default.resolve(s), description: 'directory with template files', }), extension: command_1.flags.string({ char: 'x', default: 'md', description: 'file extension for generated pages, not necessary when using READMEs', }), helpers: command_1.flags.string({ char: 'H', parse: s => path_1.default.resolve(s), description: 'path to a file whose exports will be registered as handlebars helpers', }), 'solc-module': command_1.flags.string({ parse: s => require.resolve(s, { paths: ['.'] }), description: 'path to an alternative solc module', }), 'solc-settings': command_1.flags.build({ parse: s => { const settings = json5_1.default.parse(s); if (typeof settings !== 'object' || settings === null) { throw new Error('--solc-settings must be an object'); } return settings; }, })({ description: 'compiler settings for solc module', }), 'output-structure': command_1.flags.enum({ char: 's', options: Array.from(sitemap_1.sitemapKinds), default: 'contracts', description: 'how to structure contracts across output files', }), }; if (require.main === module) { Docgen.run().then(undefined, require('@oclif/errors/handle')); } //# sourceMappingURL=cli.js.map