aboutsummaryrefslogtreecommitdiffstats
path: root/packages/sol-doc/src/cli.ts
diff options
context:
space:
mode:
authorF. Eugene Aumson <feuGeneA@users.noreply.github.com>2018-09-26 22:15:53 +0800
committerGitHub <noreply@github.com>2018-09-26 22:15:53 +0800
commit30525d15f468dc084f923b280b265cb8d5fd4975 (patch)
tree35d941998132e83e5f5b830bbe59167f404d6e42 /packages/sol-doc/src/cli.ts
parentc429409ed7a77a67368850f2e736126da0d213dd (diff)
parent2bdaa58d71fb1e62fd07e6bf1be56d841446090b (diff)
downloaddexon-sol-tools-30525d15f468dc084f923b280b265cb8d5fd4975.tar
dexon-sol-tools-30525d15f468dc084f923b280b265cb8d5fd4975.tar.gz
dexon-sol-tools-30525d15f468dc084f923b280b265cb8d5fd4975.tar.bz2
dexon-sol-tools-30525d15f468dc084f923b280b265cb8d5fd4975.tar.lz
dexon-sol-tools-30525d15f468dc084f923b280b265cb8d5fd4975.tar.xz
dexon-sol-tools-30525d15f468dc084f923b280b265cb8d5fd4975.tar.zst
dexon-sol-tools-30525d15f468dc084f923b280b265cb8d5fd4975.zip
Merge pull request #1004 from feuGeneA/sol-doc
[ethereum-types, react-docs, sol-compiler, sol-doc, types, typescript-typings, website] Add new Solidity documentation generation utility
Diffstat (limited to 'packages/sol-doc/src/cli.ts')
-rw-r--r--packages/sol-doc/src/cli.ts28
1 files changed, 28 insertions, 0 deletions
diff --git a/packages/sol-doc/src/cli.ts b/packages/sol-doc/src/cli.ts
new file mode 100644
index 000000000..eb0f00bf6
--- /dev/null
+++ b/packages/sol-doc/src/cli.ts
@@ -0,0 +1,28 @@
+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);
+});