create a script for parsing the output from bitcoind --help
to create an example conf file for new users
problem
per #10746 , bitcoin.conf
not being put into the data directory during installation causes some confusion for users when running bitcoin. in the discussion on the issue, one proposed solution was to have an example config file and instruct users to cp
it into their data directory after startup. in addition to #10746 , there have been other requests for a “skeleton config file” (https://github.com/bitcoin/bitcoin/issues/19641) to help users get started with configuring bitcoind.
the main issue with an example config file is that it creates a second source of truth regarding what options are available for configuring bitcoind. this means any changes to the options (including the addition or removal of options) would have to be updated for the command line and also updated in the example file.
this PR addresses this issue by providing a script to generate an example file directly from the bitcoind --help
on-demand by running contrib/devtools/gen-bitcoin-conf.sh
. this solution was originally proposed on #10746 and would also solve #19641 . this guarantees any changes made to the command-line options or the command-line options help would also be reflected in the example file after compiling and running the script.
the main purpose of this script is to generate a config file to be included with releases, same as gen-manpages.sh
. this ensures every release also includes an up-to-date, full example config file for users to edit. the script is also available for users who compile from source for generating an example config for their compiled binary.
special considerations
this removes the bitcoin.conf
example file from the repo as it is now generated by this script. the original example file did contain extra text related to how to use certain options but going forward all option help docs should be moved into init.cpp
this also edits init.cpp
to have the option help indicate that -conf
is not usable from the config file. this is similar to how -includeconf
’s help indicates it cannot be used from the command line