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:
Andrew Chow
2018-04-28 16:54:58 -04:00
parent 08c1caf863
commit 4d4185a4f0
17 changed files with 345 additions and 310 deletions

View File

@@ -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;