This repository was archived by the owner on Oct 28, 2021. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 2.2k
Better command line in ethkey and eth #4635
Merged
Merged
Changes from 1 commit
Commits
Show all changes
8 commits
Select commit
Hold shift + click to select a range
d255eb9
Use boost.program_options to handle command line arguments in eth and…
demon1999 d645a78
Fix formatting
gumb0 48da1c8
Catch exceptions from boost.program_options; user return from main in…
gumb0 4ba824f
Remove some deprecated options. Remove multiletter option aliases as …
gumb0 cf5a788
Remove unused functions.
gumb0 68be8c2
Remove "import" and "export" options (without dashes) and handle "--i…
gumb0 2a537ab
Remove some more unused stuff
gumb0 4b0bb1c
Replace exit() calls with return from main.
gumb0 File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Remove "import" and "export" options (without dashes) and handle "--i…
…mport" and ""--export" as other regular options
- Loading branch information
commit 68be8c2b5cb2b9c811c8a8f1774bc60a9493c132
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -338,6 +338,8 @@ int main(int argc, char** argv) | |
|
|
||
| po::options_description importExportMode("Import/export modes", c_lineWidth); | ||
| importExportMode.add_options() | ||
| ("import,I", po::value<string>()->value_name("<file>"), "Import blocks from file.") | ||
| ("export,E", po::value<string>()->value_name("<file>"), "Export blocks to file.") | ||
| ("from", po::value<string>()->value_name("<n>"), "Export only from block n; n may be a decimal, a '0x' prefixed hash, or 'latest'.") | ||
| ("to", po::value<string>()->value_name("<n>"), "Export only to block n (inclusive); n may be a decimal, a '0x' prefixed hash, or 'latest'.") | ||
| ("only", po::value<string>()->value_name("<n>"), "Equivalent to --export-from n --export-to n.") | ||
|
|
@@ -374,27 +376,12 @@ int main(int argc, char** argv) | |
| return -1; | ||
| } | ||
| for (size_t i = 0; i < unrecognisedOptions.size(); ++i) | ||
| { | ||
| string arg = unrecognisedOptions[i]; | ||
| if (m.interpretOption(i, unrecognisedOptions)) | ||
| { | ||
| } | ||
| else if ((arg == "-I" || arg == "--import" || arg == "import") && i + 1 < unrecognisedOptions.size()) | ||
| { | ||
| mode = OperationMode::Import; | ||
| filename = unrecognisedOptions[++i]; | ||
| } | ||
| else if ((arg == "-E" || arg == "--export" || arg == "export") && i + 1 < unrecognisedOptions.size()) | ||
| { | ||
| mode = OperationMode::Export; | ||
| filename = unrecognisedOptions[++i]; | ||
| } | ||
| else | ||
| if (!m.interpretOption(i, unrecognisedOptions)) | ||
| { | ||
| cerr << "Invalid argument: " << arg << "\n"; | ||
| cerr << "Invalid argument: " << unrecognisedOptions[i] << "\n"; | ||
| exit(-1); | ||
| } | ||
| } | ||
|
|
||
| #if ETH_EVMJIT | ||
| if (vm.count("vm")) | ||
|
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Don't indent the following line with brace (and if body) |
||
| { | ||
|
|
@@ -653,6 +640,16 @@ int main(int argc, char** argv) | |
| { | ||
| remotePort = vm["port"].as<short>(); | ||
| } | ||
| if (vm.count("import")) | ||
| { | ||
| mode = OperationMode::Import; | ||
| filename = vm["import"].as<string>(); | ||
| } | ||
| if (vm.count("export")) | ||
| { | ||
| mode = OperationMode::Export; | ||
| filename = vm["export"].as<string>(); | ||
| } | ||
| if (vm.count("password")) | ||
| passwordsToNote.push_back(vm["password"].as<string>()); | ||
| if (vm.count("master")) | ||
|
|
||
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Missed one
exit()here.There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
fixed