aboutsummaryrefslogtreecommitdiffstats
path: root/packages/sol-doc/src/cli.ts
blob: 1cdc35b6430af331ad92b8aa44ccfc3dd5b4e96e (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
import 'source-map-support/register';
import * as yargs from 'yargs';

import { generateSolDocAsync } from './solidity_doc_generator';

const JSON_TAB_WIDTH = 4;

(async () => {
    const argv = yargs
        .option('contracts-dir', {
            type: 'string',
            description: 'path of contracts directory to compile',
        })
        .option('contracts', {
            type: 'string',
            description: 'comma separated list of contracts to compile',
        })
        .demandOption('contracts-dir')
        .array('contracts')
        .help().argv;
    process.stdout.write(
        JSON.stringify(await generateSolDocAsync(argv.contractsDir, argv.contracts), null, JSON_TAB_WIDTH),
    );
})().catch(err => {
    throw err;
});