mirror of
https://github.com/bitcoin/bitcoin.git
synced 2026-03-21 13:10:08 +01:00
Give an error and exit if there are unknown parameters
If an unknown option is given via either the command line args or the conf file, throw an error and exit Update tests for ArgsManager knowing args Ignore unknown options in the config file for bitcoin-cli Fix tests and bitcoin-cli to match actual options used
This commit is contained in:
@@ -33,13 +33,21 @@ static void SetupBenchArgs()
|
||||
gArgs.AddArg("-plot-plotlyurl=<uri>", strprintf("URL to use for plotly.js (default: %s)", DEFAULT_PLOT_PLOTLYURL), false, OptionsCategory::OPTIONS);
|
||||
gArgs.AddArg("-plot-width=<x>", strprintf("Plot width in pixel (default: %u)", DEFAULT_PLOT_WIDTH), false, OptionsCategory::OPTIONS);
|
||||
gArgs.AddArg("-plot-height=<x>", strprintf("Plot height in pixel (default: %u)", DEFAULT_PLOT_HEIGHT), false, OptionsCategory::OPTIONS);
|
||||
|
||||
// Hidden
|
||||
gArgs.AddArg("-h", "", false, OptionsCategory::HIDDEN);
|
||||
gArgs.AddArg("-help", "", false, OptionsCategory::HIDDEN);
|
||||
}
|
||||
|
||||
int
|
||||
main(int argc, char** argv)
|
||||
{
|
||||
SetupBenchArgs();
|
||||
gArgs.ParseParameters(argc, argv);
|
||||
std::string error;
|
||||
if (!gArgs.ParseParameters(argc, argv, error)) {
|
||||
fprintf(stderr, "Error parsing command line arguments: %s\n", error.c_str());
|
||||
return false;
|
||||
}
|
||||
|
||||
if (HelpRequested(gArgs)) {
|
||||
std::cout << gArgs.GetHelpMessage();
|
||||
|
||||
Reference in New Issue
Block a user