Have gArgs handle printing help #13190

pull achow101 wants to merge 1 commits into bitcoin:master from achow101:gargs-help changing 17 files +353 −318
  1. achow101 commented at 6:27 pm on May 8, 2018: member

    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.

  2. jnewbery commented at 7:04 pm on May 8, 2018: member
    Concept ACK
  3. MarcoFalke commented at 7:10 pm on May 8, 2018: member
    I guess you’d have to cherry-pick the fixup to contrib/check-doc as well.
  4. in src/init.cpp:384 in 3333c7ef48 outdated
    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);
    


    MarcoFalke commented at 7:24 pm on May 8, 2018:
    Rebase issue? (Translation string was changed)

    achow101 commented at 7:48 pm on May 8, 2018:
    Oops, fixed
  5. MarcoFalke commented at 7:36 pm on May 8, 2018: member

    Tested ACK 3333c7ef48cfde42619b7f6ae62893de192ed574:

    • Bumped the man pages in a commit on current master, cherry-picked 3333c7ef48cfde42619b7f6ae62893de192ed574, Generated the man pages and checked that git diff only shows differences to to sort-by-name.
    • Additionally checked that the strings are move-only by hand
    • Did an utACK on the code changes.
  6. achow101 force-pushed on May 8, 2018
  7. achow101 commented at 7:49 pm on May 8, 2018: member
    I added a commit for the check-doc fix.
  8. MarcoFalke commented at 7:52 pm on May 8, 2018: member
    re-ACK 3ea4d9080d615e09017c23e9678f47c9edddb869 (only changes were suggested fixups)
  9. promag commented at 10:08 pm on May 8, 2018: member

    utACK 3ea4d90.

    Please squash otherwise check-doc.py fails for 1st commit.

  10. achow101 commented at 10:26 pm on May 8, 2018: member
    Squashed
  11. achow101 force-pushed on May 8, 2018
  12. sipa commented at 1:50 am on May 9, 2018: member

    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.

  13. meshcollider added the label Refactoring on May 9, 2018
  14. meshcollider commented at 6:16 am on May 9, 2018: contributor
    Concept ACK, makes sense to split this out
  15. MarcoFalke commented at 1:53 pm on May 9, 2018: member
    Needs rebase
  16. Make gArgs aware of the arguments
    gArgs knows what the available arguments are and their help. Getting
    the help message is moved to gArgs and HelpMessage() is removed
    4d4185a4f0
  17. achow101 commented at 4:21 pm on May 9, 2018: member
    Rebased
  18. achow101 force-pushed on May 9, 2018
  19. in src/util.h:259 in 4d4185a4f0
    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();
    


    sipa commented at 5:05 pm on May 9, 2018:
    I believe this can be marked const.
  20. in src/util.cpp:567 in 4d4185a4f0
    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)
    


    sipa commented at 5:06 pm on May 9, 2018:
    Code style nit: use braces when putting then/else branches on separate lines.
  21. sipa commented at 5:10 pm on May 9, 2018: member

    reutACK 4d4185a4f0e40c033a587871839a47cb3f89ee93

    Two nits below, but feel free to ignore. This is probably a pain to keep rebasing.

  22. laanwj commented at 5:23 pm on May 9, 2018: member
    Code review and lightly tested ACK 4d4185a4f0e40c033a587871839a47cb3f89ee93
  23. MarcoFalke commented at 6:33 pm on May 9, 2018: member
    re-ACK 4d4185a4f0e40c033a587871839a47cb3f89ee93 (only change was rebase)
  24. MarcoFalke merged this on May 9, 2018
  25. MarcoFalke closed this on May 9, 2018

  26. MarcoFalke referenced this in commit fc642cbdad on May 9, 2018
  27. MarcoFalke referenced this in commit 61fcef0f89 on May 30, 2018
  28. AtsukiTak referenced this in commit 9544a3f3fc on Jul 21, 2018
  29. Bushstar referenced this in commit 56268b4078 on Jul 24, 2018
  30. HashUnlimited referenced this in commit 41e92ec956 on Sep 12, 2018
  31. joemphilips referenced this in commit d772646844 on Nov 9, 2018
  32. jfhk referenced this in commit 32c40f4054 on Nov 14, 2018
  33. meshcollider referenced this in commit 91fcb9ff66 on Sep 8, 2019
  34. jasonbcox referenced this in commit e89f30d274 on Oct 11, 2019
  35. jonspock referenced this in commit a14043af57 on Dec 27, 2019
  36. jonspock referenced this in commit a07621a5d0 on Dec 29, 2019
  37. UdjinM6 referenced this in commit 6bcc1bf0a3 on Mar 19, 2021
  38. UdjinM6 referenced this in commit 3c20f48283 on Jun 19, 2021
  39. UdjinM6 referenced this in commit 66477fbf32 on Jun 24, 2021
  40. UdjinM6 referenced this in commit 836c7383bb on Jun 26, 2021
  41. UdjinM6 referenced this in commit f48b5a1c45 on Jun 26, 2021
  42. UdjinM6 referenced this in commit 0fcb967e4d on Jun 28, 2021
  43. MarcoFalke locked this on Sep 8, 2021

github-metadata-mirror

This is a metadata mirror of the GitHub repository bitcoin/bitcoin. This site is not affiliated with GitHub. Content is generated from a GitHub metadata backup.
generated: 2024-07-01 10:13 UTC

This site is hosted by @0xB10C
More mirrored repositories can be found on mirror.b10c.me