mirror of
https://github.com/bitcoin/bitcoin.git
synced 2025-11-13 07:28:59 +01:00
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
This commit is contained in:
28
src/util.h
28
src/util.h
@@ -118,6 +118,23 @@ inline bool IsSwitchChar(char c)
|
||||
#endif
|
||||
}
|
||||
|
||||
enum class OptionsCategory
|
||||
{
|
||||
OPTIONS,
|
||||
CONNECTION,
|
||||
WALLET,
|
||||
WALLET_DEBUG_TEST,
|
||||
ZMQ,
|
||||
DEBUG_TEST,
|
||||
CHAINPARAMS,
|
||||
NODE_RELAY,
|
||||
BLOCK_CREATION,
|
||||
RPC,
|
||||
GUI,
|
||||
COMMANDS,
|
||||
REGISTER_COMMANDS
|
||||
};
|
||||
|
||||
class ArgsManager
|
||||
{
|
||||
protected:
|
||||
@@ -128,6 +145,7 @@ protected:
|
||||
std::map<std::string, std::vector<std::string>> m_config_args;
|
||||
std::string m_network;
|
||||
std::set<std::string> m_network_only_args;
|
||||
std::map<std::pair<OptionsCategory, std::string>, std::pair<std::string, bool>> m_available_args;
|
||||
|
||||
void ReadConfigStream(std::istream& stream);
|
||||
|
||||
@@ -229,6 +247,16 @@ public:
|
||||
* @return CBaseChainParams::MAIN by default; raises runtime error if an invalid combination is given.
|
||||
*/
|
||||
std::string GetChainName() const;
|
||||
|
||||
/**
|
||||
* Add argument
|
||||
*/
|
||||
void AddArg(const std::string& name, const std::string& help, const bool debug_only, const OptionsCategory& cat);
|
||||
|
||||
/**
|
||||
* Get the help string
|
||||
*/
|
||||
std::string GetHelpMessage();
|
||||
};
|
||||
|
||||
extern ArgsManager gArgs;
|
||||
|
||||
Reference in New Issue
Block a user