aboutsummaryrefslogblamecommitdiffstats
path: root/packages/sol-doc/src/cli.ts
blob: eb0f00bf63f09c2b59c04868e7a1a9eea29d48ff (plain) (tree)
1
2
3
4
5
6
7
8


                                     

                                            

                                                               
                         













                                                                        

                                                                             
                   

                       
   
import 'source-map-support/register';
import * as yargs from 'yargs';

import { logUtils } from '@0xproject/utils';

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;
    const doc = await generateSolDocAsync(argv.contractsDir, argv.contracts);
    process.stdout.write(JSON.stringify(doc, null, JSON_TAB_WIDTH));
})().catch(err => {
    logUtils.warn(err);
    process.exit(1);
});