aboutsummaryrefslogtreecommitdiff
path: root/src/util.h
diff options
context:
space:
mode:
authorAndrew Chow <[email protected]>2018-04-28 16:54:58 -0400
committerAndrew Chow <[email protected]>2018-05-09 12:21:05 -0400
commit4d4185a4f0e40c033a587871839a47cb3f89ee93 (patch)
treede7d02bcfe19bafb3faf0f220a35b303fbfc3ba8 /src/util.h
parentMerge #13185: Bugfix: the end of a reorged chain is invalid when connect fails (diff)
downloaddiscoin-4d4185a4f0e40c033a587871839a47cb3f89ee93.tar.xz
discoin-4d4185a4f0e40c033a587871839a47cb3f89ee93.zip
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
Diffstat (limited to 'src/util.h')
-rw-r--r--src/util.h28
1 files changed, 28 insertions, 0 deletions
diff --git a/src/util.h b/src/util.h
index 186245c94..17dd5c068 100644
--- a/src/util.h
+++ b/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;