forked from trufflesuite/truffle-core
-
Notifications
You must be signed in to change notification settings - Fork 0
/
cli.js
executable file
·42 lines (37 loc) · 1.25 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
#!/usr/bin/env node
require('source-map-support/register')
var Config = require("truffle-config");
var Command = require("./lib/command");
var TaskError = require("./lib/errors/taskerror");
var TruffleError = require("truffle-error");
var version = require("./lib/version");
var OS = require("os");
var command = new Command(require("./lib/commands"));
var options = {
logger: console
};
command.run(process.argv.slice(2), options, function(err) {
if (err) {
if (err instanceof TaskError) {
command.args
.usage("Truffle v" + (version.bundle || version.core) + " - a development framework for Ethereum"
+ OS.EOL + OS.EOL
+ 'Usage: truffle <command> [options]')
.epilog("See more at http://truffleframework.com/docs")
.showHelp();
} else {
if (err instanceof TruffleError) {
console.log(err.message);
} else if (typeof err == "number") {
// If a number is returned, exit with that number.
process.exit(err);
} else {
// Bubble up all other unexpected errors.
console.log(err.stack || err.toString());
}
}
process.exit(1);
}
// Don't exit if no error; if something is keeping the process open,
// like `truffle console`, then let it.
});