Inspired by some discussions about RPC documentations ( #14399, #14378 ) I have decided to create a RPC help helper class, that automatically formats the RPC help.
This should be helpful in few respects:
- it makes the code cleaner
- it formats the help automatically
- in the future (I am leaving this for a follow-up PR), it can allow to export JSON, which will allow to make nicer HTML documentation :)
The new classes are in rpc/doc.cpp and they are added in the first commit
The second commit is the actual doc rewrite. The process of rewriting current docs to what is in the PR was semi-automatic - unfortunately, not automatic enough to make it a scripted diff. What I did:
- wrote a parser of the current RPC documentation
- made some changes to the RPC help to be parseable
- generated the code in the PR from that
- manually cleaned up the code on a lot of places
It’s still a huge chunk of code, even when it is just RPC help.
(Third commit is then removing the unused helper function.)
I think it does the same what @achow101 has been trying (by adding what I have in RPCDoc to UniValue instead) here https://github.com/achow101/bitcoin/tree/rpc-help-univ ; I did not use that because I did not fully understand how it was supposed to be working