-
Notifications
You must be signed in to change notification settings - Fork 4
/
Copy pathcli.js
executable file
·65 lines (59 loc) · 1.48 KB
/
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
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
#!/usr/bin/env node
require('dotenv').load();
const fs = require("fs");
const path = require("path");
const _ = require("lodash");
const minimist = require("minimist");
const chalk = require("chalk");
const { log } = console;
module.exports = (() => {
const args = minimist(process.argv.slice(2));
let cmd = args._[0] || "help";
if (args.version || args.v) {
cmd = "version";
}
if (args.help || args.h) {
cmd = "help";
}
switch (cmd) {
case "eN":
case "extractNetworks":
require("./network/extract-network-info.js")(args);
break;
case "iN":
case "injectNetworks":
require("./network/inject-network-info.js")(args);
break;
case "mG":
case "measureGas":
require('./gas/measureGas.js')(args);
break;
case "dT":
case "decodeTransactions":
require('./decode/decode-transactions.js')(args);
break;
case "cI":
case "createInterface":
require('./abi/create-interface.js')(args);
break;
case "cB":
case "cleanBuild":
require('./contract/clean-build.js')(args);
break;
case "version":
require("./generic/version")(args);
break;
case "help":
require("./generic/help")(args);
break;
default:
console.error(
`${chalk.red.bold(cmd)} ${chalk.bold(
"is not a valid command! Try"
)} ${chalk.red.bold("tnt help")} ${chalk.bold(
"to access a list of valid commands"
)}`
);
break;
}
})();