Conversation
chfast
left a comment
There was a problem hiding this comment.
Sorry for delays in reviews. Everyone is on devcon3.
rlp/main.cpp
Outdated
| otherInputs.push_back(arg); | ||
| } | ||
| if (vm.count("help")) { | ||
| cout << "Usage rlp <mode> [OPTIONS]" << endl << modesOptions |
There was a problem hiding this comment.
I'm not expert here, but shouldn't the program_options be able to output that for us?
Codecov Report
@@ Coverage Diff @@
## develop #4639 +/- ##
===========================================
+ Coverage 60.9% 61.09% +0.18%
===========================================
Files 343 343
Lines 26999 27089 +90
Branches 2765 2779 +14
===========================================
+ Hits 16444 16550 +106
+ Misses 9603 9569 -34
- Partials 952 970 +18
Continue to review full report at Codecov.
|
gumb0
left a comment
There was a problem hiding this comment.
Ok, the help output looks a little weird now:
Usage rlp <mode> [OPTIONS]
Modes:
-i [ --indent ] arg <string> Use string as the level indentation (default
' ').
--hex-ints Render integers in hex.
--string-ints Render integers in the same way as strings.
--ascii-strings Render data as C-style strings or hex depending on
content being ASCII.
--force-string Force all data to be rendered as C-style strings.
--force-escape When rendering as C-style strings, force all characters
to be escaped.
--force-hex Force all data to be rendered as raw hex.
-D [ --dapp ] Dapp-building mode; equivalent to --encrypt --64.
create <json> Given a simplified JSON string, output the RLP.
render [ <file> | -- ] Render the given RLP. Options:
list [ <file> | -- ] List the items in the RLP list by hash and size.
extract [ <file> | -- ] Extract all items in the RLP list, named by hash.
assemble [ <manifest> | <base path> ] <file> ... Given a manifest & files, output the RLP.
General options:
-e [ --encrypt ] Encrypt the RLP data prior to output.
-L [ --lenience ] Try not to bomb out early if possible.
-x [ --hex ] Treat input RLP as hex encoded data.
--base-16 Treat input RLP as hex encoded data.
-k [ --keccak ] Output Keccak-256 hash only.
--base-64 Treat input RLP as base-64 encoded data.
--64 Treat input RLP as base-64 encoded data.
-b [ --bin ] Treat input RLP as raw binary data.
--base-256 Treat input RLP as raw binary data.
-q [ --quiet ] Don't place additional information on stderr.
-h [ --help ] Print this help message and exit.
-V [ --version ] Show the version and exit.
We should figure out how to make it better, modes (create, render, list, extract, assemble) should be on the top, after Modes:
The options on top I think make sense for the render mostly, so maybe they should have title "Render Options"
Also please move -D into General options, because it's a combination of two other general options, I think it fits there better
rlp/main.cpp
Outdated
| prefs.escapeAll = true; | ||
| if (vm.count("nice")) | ||
| prefs.forceString = true, prefs.stringInts = false, prefs.forceHex = false, prefs.indent = " "; | ||
| if (vm.count("lenience")) |
There was a problem hiding this comment.
Here's the duplicated piece of code from lenience till encrypt
|
What if we change it to The challenge might be in different modes having different number of arguments following them (like Check out also "positional options". maybe it helps somehow http://www.boost.org/doc/libs/1_58_0/doc/html/program_options/tutorial.html#idp337627504 |
|
What happened to the indentation? Looks like it all changed to spaces |
|
It's my fault. I'll fix it |
gumb0
left a comment
There was a problem hiding this comment.
Also further please use more descriptive commit messages than "Update main.cpp"
rlp/main.cpp
Outdated
| case Encoding::Keccak: | ||
| cout << sha3(_out).hex() << endl; | ||
| break; | ||
| case Encoding::Hex: case Encoding::Auto: |
There was a problem hiding this comment.
Don't change the indentation of casess inside switches, I just fixed it before in my commit here
| @@ -1,16 +1,13 @@ | |||
| /* | |||
| This file is part of cpp-ethereum. | |||
|
|
|||
There was a problem hiding this comment.
Don't remove these empty lines in comments
|
|
||
| hunter_add_package(Boost COMPONENTS filesystem system thread) | ||
| find_package(Boost CONFIG REQUIRED filesystem system thread) | ||
| hunter_add_package(Boost COMPONENTS program_options filesystem system thread) |
There was a problem hiding this comment.
Hasn't this been merged to develop already?
| << renderOptions << generalOptions; | ||
| exit(0); | ||
| } | ||
| if (vm.count("lenience")) |
There was a problem hiding this comment.
This seems to be a weird way of doing this. Can't we inform boost we would like to store this option in bool lenience variable and use the variable directly?
There was a problem hiding this comment.
This is the way suggested by the official tutorials http://www.boost.org/doc/libs/1_65_1/doc/html/program_options/tutorial.html#idp437555840
But there's an option to store it in a local variable, too, I think.
This way is actually more compact (no need to define a local variable for each option), but duplicating the option name is a downside
|
Rebase and merge? |
|
I'll rebase it |
fixing rlp
fixing formating
No description provided.