This commit is contained in:
Marek Kotewicz 2014-11-10 22:51:10 +01:00
parent 8c384232eb
commit a44bd8c987

View File

@ -42,7 +42,8 @@ void help()
{ {
cout << "Usage solc [OPTIONS] <file>" << endl cout << "Usage solc [OPTIONS] <file>" << endl
<< "Options:" << endl << "Options:" << endl
<< " -h,--help Show this help message and exit." << endl << " -o,--optimize Optimize the bytecode for size." << endl
<< " -h,--help Show this help message and exit." << endl
<< " -V,--version Show the version and exit." << endl; << " -V,--version Show the version and exit." << endl;
exit(0); exit(0);
} }
@ -58,10 +59,13 @@ void version()
int main(int argc, char** argv) int main(int argc, char** argv)
{ {
string infile; string infile;
bool optimize = false;
for (int i = 1; i < argc; ++i) for (int i = 1; i < argc; ++i)
{ {
string arg = argv[i]; string arg = argv[i];
if (arg == "-h" || arg == "--help") if (arg == "-o" || arg == "--optimize")
optimize = true;
else if (arg == "-h" || arg == "--help")
help(); help();
else if (arg == "-V" || arg == "--version") else if (arg == "-V" || arg == "--version")
version(); version();
@ -98,7 +102,7 @@ int main(int argc, char** argv)
printer.print(cout); printer.print(cout);
compiler.compileContract(*ast); compiler.compileContract(*ast);
instructions = compiler.getAssembledBytecode(); instructions = compiler.getAssembledBytecode(optimize);
} }
catch (ParserError const& exception) catch (ParserError const& exception)
{ {