Instead of each binary generating and printing it's own help string, have gArgs know what the args are and generate the help string.
This is the first commit of #13112 pulled out.
Concept ACK
I guess you'd have to cherry-pick the fixup to contrib/check-doc as well.
453 | + 454 | + gArgs.AddArg("-addnode=<ip>", _("Add a node to connect to and attempt to keep the connection open (see the `addnode` RPC command help for more info)"), false, OptionsCategory::CONNECTION); 455 | + gArgs.AddArg("-banscore=<n>", strprintf(_("Threshold for disconnecting misbehaving peers (default: %u)"), DEFAULT_BANSCORE_THRESHOLD), false, OptionsCategory::CONNECTION); 456 | + gArgs.AddArg("-bantime=<n>", strprintf(_("Number of seconds to keep misbehaving peers from reconnecting (default: %u)"), DEFAULT_MISBEHAVING_BANTIME), false, OptionsCategory::CONNECTION); 457 | + gArgs.AddArg("-bind=<addr>", _("Bind to given address and always listen on it. Use [host]:port notation for IPv6"), false, OptionsCategory::CONNECTION); 458 | + gArgs.AddArg("-connect=<ip>", _("Connect only to the specified node(s, false, OptionsCategory::OPTIONS)); -connect=0 disables automatic connections (the rules for this peer are the same as for -addnode)"), false, OptionsCategory::CONNECTION);
Rebase issue? (Translation string was changed)
Oops, fixed
Tested ACK 3333c7ef48cfde42619b7f6ae62893de192ed574:
git diff only shows differences to to sort-by-name.I added a commit for the check-doc fix.
re-ACK 3ea4d9080d615e09017c23e9678f47c9edddb869 (only changes were suggested fixups)
utACK 3ea4d90.
Please squash otherwise check-doc.py fails for 1st commit.
Squashed
utACK dadad0d559f62ff7d9752655dc4bbb922e97423d
I did not review all the command line help/AddArg statements, but I did compare the output of -help and -help -help-debug before and after.
Concept ACK, makes sense to split this out
Needs rebase
gArgs knows what the available arguments are and their help. Getting
the help message is moved to gArgs and HelpMessage() is removed
Rebased
254 | + void AddArg(const std::string& name, const std::string& help, const bool debug_only, const OptionsCategory& cat); 255 | + 256 | + /** 257 | + * Get the help string 258 | + */ 259 | + std::string GetHelpMessage();
I believe this can be marked const.
562 | + 563 | + OptionsCategory last_cat = OptionsCategory::OPTIONS; 564 | + for (auto& arg : m_available_args) { 565 | + if (arg.first.first != last_cat) { 566 | + last_cat = arg.first.first; 567 | + if (last_cat == OptionsCategory::CONNECTION)
Code style nit: use braces when putting then/else branches on separate lines.
reutACK 4d4185a4f0e40c033a587871839a47cb3f89ee93
Two nits below, but feel free to ignore. This is probably a pain to keep rebasing.
Code review and lightly tested ACK 4d4185a4f0e40c033a587871839a47cb3f89ee93
re-ACK 4d4185a4f0e40c033a587871839a47cb3f89ee93 (only change was rebase)