Better command line in ethkey and eth#4635
Conversation
Codecov Report
@@ Coverage Diff @@
## develop #4635 +/- ##
===========================================
- Coverage 60.88% 58.44% -2.44%
===========================================
Files 343 338 -5
Lines 27111 25677 -1434
Branches 2781 3141 +360
===========================================
- Hits 16506 15008 -1498
+ Misses 9621 9616 -5
- Partials 984 1053 +69
Continue to review full report at Codecov.
|
eth/MinerAux.h
Outdated
| } | ||
|
|
||
| bool interpretOption(int& i, int argc, char** argv) | ||
| bool interpretOption(size_t& i, const vector<string>& argv) |
There was a problem hiding this comment.
const should be after type name according to our coding style, so should be vector<string> const&
eth/main.cpp
Outdated
| #include <boost/program_options.hpp> | ||
| #include <boost/program_options/options_description.hpp> | ||
|
|
||
| /* |
There was a problem hiding this comment.
This comment block shouldn't be here
eth/main.cpp
Outdated
| * Ethereum client. | ||
| */ | ||
|
|
||
| #include <thread> |
There was a problem hiding this comment.
Some #includes are now duplicated in this file, remove it
eth/main.cpp
Outdated
| if (vm.count("client-name")) | ||
| clientName = vm["client-name"].as<string>(); | ||
| if (vm.count("address")) | ||
| try { |
There was a problem hiding this comment.
braces should be on a separate line
ethkey/main.cpp
Outdated
| ("version,V", "Show the version and exit.") | ||
| ("help,h", "Show this help message and exit."); | ||
| po::parsed_options parsed = po::command_line_parser(argc, argv).options(generalOptions).allow_unregistered().run(); | ||
| vector<string> to_pass_further = collect_unrecognized(parsed.options, po::include_positional); |
There was a problem hiding this comment.
variable names should use camelCase, I'd name this unrecognisedOptions
|
fixed |
gumb0
left a comment
There was a problem hiding this comment.
First some simple requests, mostly to fix formatting
eth/main.cpp
Outdated
| if (_interactive) | ||
| cout | ||
| << "Type 'exit' to quit\n\n"; | ||
| << "Type 'exit' to quit\n\n"; |
There was a problem hiding this comment.
Not sure why you changed it, but anyway better put it on the same line as cout
eth/main.cpp
Outdated
| ("test", "Testing mode: Disable PoW and provide test rpc interface.") | ||
| ("config", po::value<string>(), "<file> Configure specialised blockchain using given JSON information.") | ||
| ("mode,o", po::value<string>(), "<full/peer> Start a full node or a peer node (default: full).\n") | ||
| ("json-rpc,j", "Enable JSON-RPC server (default: off).") |
There was a problem hiding this comment.
That was misleading description, let's change it to Enable the HTTP-RPC server (similar to geth)
eth/main.cpp
Outdated
| for (int i = 1; i < argc; ++i) | ||
| po::options_description clientDefaultMode("Client mode (default)"); | ||
| clientDefaultMode.add_options() | ||
| ("format", po::value<string>(), "<format> Set format.") |
There was a problem hiding this comment.
<binary/hex/human> Set the export format.
| else if (arg == "--upnp" && i + 1 < argc) | ||
| } | ||
| #if ETH_EVMJIT | ||
| if (vm.count("vm")) |
There was a problem hiding this comment.
Don't indent the following line with brace (and if body)
eth/main.cpp
Outdated
| cerr << "provided genesis block description is not well formatted\n"; | ||
| string genesisSample = | ||
| R"E( | ||
| R"E( |
There was a problem hiding this comment.
Don't change the indentation here
eth/main.cpp
Outdated
| rpc::NetFace, rpc::Web3Face, rpc::PersonalFace, | ||
| rpc::AdminEthFace, rpc::AdminNetFace, rpc::AdminUtilsFace, | ||
| rpc::DebugFace, rpc::TestFace | ||
| rpc::EthFace, rpc::WhisperFace, |
There was a problem hiding this comment.
No reason to change the indentation here
eth/main.cpp
Outdated
| adminEth, adminNet, adminUtils, | ||
| new rpc::Debug(*web3.ethereum()), | ||
| testEth | ||
| ethFace, new rpc::Whisper(web3, {}), |
eth/main.cpp
Outdated
| new rpc::AdminUtils(*sessionManager.get()), | ||
| new rpc::Debug(*web3.ethereum()), | ||
| testEth | ||
| ethFace, new rpc::Whisper(web3, {}), new rpc::Net(web3), |
ethkey/main.cpp
Outdated
| po::variables_map vm; | ||
| po::store(parsed, vm); | ||
| po::notify(vm); | ||
| if (vm.count("help")) { |
eth/main.cpp
Outdated
| for (int i = 1; i < argc; ++i) | ||
| po::options_description clientDefaultMode("Client mode (default)"); | ||
| clientDefaultMode.add_options() | ||
| ("format", po::value<string>(), "<format> Set format.") |
There was a problem hiding this comment.
I would prefer these lines to be one tab indented, not 2 tabs like you did ( I don't see the reason to make it unusual 2 tabs and it can lead to some additional line breaks, which makes it harder to read)
eth/main.cpp
Outdated
| new rpc::AdminEth(*web3.ethereum(), *gasPricer.get(), keyManager, *sessionManager.get()), | ||
| new rpc::AdminNet(web3, *sessionManager.get()), | ||
| new rpc::AdminUtils(*sessionManager.get()), | ||
| new rpc::Debug(*web3.ethereum()), |
There was a problem hiding this comment.
this doesn't compile, why did fixedtesteth disappear?
eth/main.cpp
Outdated
| jsonrpcIpcServer->addConnector(ipcConnector); | ||
| ipcConnector->StartListening(); | ||
| } | ||
| } testEth |
There was a problem hiding this comment.
ah, here it is, please fix this
|
I guess |
eth/main.cpp
Outdated
| Secret s(fromHex(vm["import-session-secret"].as<string>())); | ||
| toImport.emplace_back(s); | ||
| } | ||
| if (vm.count("help")) { |
ethkey/main.cpp
Outdated
| ("verbosity,v", po::value<int>(), "<0 - 9> Set the log verbosity from 0 to 9 (default: 8).") | ||
| ("version,V", "Show the version and exit.") | ||
| ("help,h", "Show this help message and exit."); | ||
| po::parsed_options parsed = po::command_line_parser(argc, argv).options(generalOptions).allow_unregistered().run(); |
There was a problem hiding this comment.
We should catch exceptions thrown from this, because parsing options can end with errors... See like I did it in #4639
|
Squashed everything into one commit and rebased on develop. Tried not to loose anything. |
9011145 to
f74b3ed
Compare
ethkey/main.cpp
Outdated
| ("verbosity,v", po::value<int>(), "<0 - 9> Set the log verbosity from 0 to 9 (default: 8).") | ||
| ("version,V", "Show the version and exit.") | ||
| ("help,h", "Show this help message and exit."); | ||
| po::parsed_options parsed = po::command_line_parser(argc, argv).options(generalOptions).allow_unregistered().run(); |
There was a problem hiding this comment.
We should catch exceptions here, too
ethkey/main.cpp
Outdated
| << "Options:" << endl << endl; | ||
| KeyCLI::streamHelp(cout); | ||
| cout << generalOptions; | ||
| exit(0); |
…boost.program_options doesn't support them. Help output improvements.
|
For anyone interested here's the summary of non-backwards compatible changes affecting working command line options:
|
…mport" and ""--export" as other regular options
eth/main.cpp
Outdated
| listenIP = argv[++i]; | ||
| listenSet = true; | ||
| cerr << "Invalid argument: " << unrecognisedOptions[i] << "\n"; | ||
| exit(-1); |
|
Note to self, need to update https://github.com/karalabe/hive/blob/master/clients/cpp-ethereum:develop/eth.sh#L142 |
|
@holiman Also this one https://github.com/karalabe/hive/blob/master/clients/cpp-ethereum:develop/eth.sh#L161 |
|
Can that be started before |
|
@karalabe does hive use the HTTP endpoints, or the ipc endpoints when the simulator queries the nodes? |
|
@holiman I think |
|
It should not matter. In case it does let me know. |
|
@chfast It looks like it doesn't find ipc socket when starting it wihout runnin |
|
Ok. I will fix it later on. |
Better comand line in ethkey and eth