aboutsummaryrefslogtreecommitdiffstats
path: root/packages/sol-doc/src/cli.ts
diff options
context:
space:
mode:
authorF. Eugene Aumson <gene@aumson.org>2018-09-21 22:56:17 +0800
committerF. Eugene Aumson <gene@aumson.org>2018-09-22 22:14:49 +0800
commit3e5d427d4e873080f2a369db7f844cbadd610fcb (patch)
tree214cd2cad9ce278aeac61f25a31f6ccccb5637cb /packages/sol-doc/src/cli.ts
parent301e491952707cdad8929cb918209a3792201a7d (diff)
downloaddexon-sol-tools-3e5d427d4e873080f2a369db7f844cbadd610fcb.tar
dexon-sol-tools-3e5d427d4e873080f2a369db7f844cbadd610fcb.tar.gz
dexon-sol-tools-3e5d427d4e873080f2a369db7f844cbadd610fcb.tar.bz2
dexon-sol-tools-3e5d427d4e873080f2a369db7f844cbadd610fcb.tar.lz
dexon-sol-tools-3e5d427d4e873080f2a369db7f844cbadd610fcb.tar.xz
dexon-sol-tools-3e5d427d4e873080f2a369db7f844cbadd610fcb.tar.zst
dexon-sol-tools-3e5d427d4e873080f2a369db7f844cbadd610fcb.zip
feat: add sol-doc command-line interface
modified sol-compiler to output progress/warning/error/etc messages to stderr rather than stdout, so that sol-doc can put its output (and nothing else) to stdout. for posterity, added sol-doc cli usage as npm scripts to package.json.
Diffstat (limited to 'packages/sol-doc/src/cli.ts')
-rw-r--r--packages/sol-doc/src/cli.ts26
1 files changed, 26 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..59fc185de
--- /dev/null
+++ b/packages/sol-doc/src/cli.ts
@@ -0,0 +1,26 @@
+import 'source-map-support/register';
+import * as yargs from 'yargs';
+
+import { generateSolDocAsync } from './solidity_doc_generator';
+
+const JSON_TABWIDTH = 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_TABWIDTH),
+ );
+})().catch(err => {
+ throw err;
+});