-
Notifications
You must be signed in to change notification settings - Fork 12
/
Copy pathcli.js
executable file
·42 lines (37 loc) · 921 Bytes
/
cli.js
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
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
#!/usr/bin/env node
const yargs = require('yargs');
const typesToCode = require('./index');
const path = require('path');
const argv = yargs
.option('input', {
alias: 'i',
describe: 'Input file path',
demandOption: true,
type: 'string',
})
.option('test', {
alias: 't',
describe: 'Just testinawerareg',
demandOption: false,
type: 'string',
})
.option('entryPoints', {
alias: 'e',
describe: 'Type names to be used as entry points',
demandOption: true,
array: true,
type: 'string',
})
.option('log', {
alias: 'l',
describe: 'Enable logging',
type: 'boolean',
})
.help()
.alias('help', 'h')
.argv;
const targetPath = path.resolve(process.cwd(), argv.input);
const types = require(targetPath);
const entryPoints = argv.entryPoints;
const shouldLog = argv.log;
console.log(typesToCode.generateSolidity(types, shouldLog, entryPoints));