MCPcopy Create free account
hub / github.com/Achain-Dev/Achain / parse_option_variables

Function parse_option_variables

src/Chain/libraries/client/Client.cpp:106–176  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

104 const program_options::variables_map& option_variables);
105
106 program_options::variables_map parse_option_variables(int argc, char** argv) {
107 // parse command-line options
108 program_options::options_description option_config("Usage");
109 option_config.add_options()
110 ("help", "Display this help message and exit")
111 ("version", "Print version information and exit")
112 ("data-dir", program_options::value<FilePath>(), "Set client data directory")
113 ("wallet-dir", program_options::value<string>(), "Set Wallet db directory")
114 ("genesis-config", program_options::value<string>(),
115 "Generate a genesis state with the given JSON file instead of using the built-in "
116 "genesis block (only accepted when the blockchain is empty)")
117 ("rebuild-index", "Same as --resync-blockchain, except it preserves the raw blockchain data rather "
118 "than downloading a new copy")
119 ("resync-blockchain", "Delete our copy of the blockchain at startup and download a "
120 "fresh copy of the entire blockchain from the network")
121 ("statistics-enabled",
122 "Index additional blockchain statistics; requires a rebuild or resync if blocks have already been applied")
123 ("p2p-port", program_options::value<string>(), "Set network port to listen on (prepend 'r' to enable SO_REUSEADDR)")
124 ("accept-incoming-connections", program_options::value<bool>()->default_value(true), "Set to false to reject incoming p2p connections and only establish outbound connections")
125 ("upnp", program_options::value<bool>()->default_value(true), "Enable UPNP")
126 ("max-connections", program_options::value<uint16_t>(),
127 "Set the maximum number of peers this node will accept at any one time")
128 ("total-bandwidth-limit", program_options::value<uint32_t>()->default_value(1000000),
129 "Limit total bandwidth to this many bytes per second")
130 ("min-delegate-connection-count", program_options::value<uint32_t>(),
131 "Override the default minimum connection count needed to produce a block")
132 ("clear-peer-database", "Erase all information in the peer database")
133 ("connect-to", program_options::value<std::vector<string> >(), "Set a remote host to connect to")
134 ("disable-default-peers", "Disable automatic connection to default peers")
135 ("disable-peer-advertising", "Don't let any peers know which other nodes we're connected to")
136 ("server", "Enable JSON-RPC server")
137 ("daemon", "Run in daemon mode with no CLI and start JSON-RPC server")
138 ("rpcuser", program_options::value<string>(), "Set username for JSON-RPC")
139 ("rpcpassword", program_options::value<string>(), "Set password for JSON-RPC")
140 ("rpcendpoint", program_options::value<string>(), "Set interface/port to listen for JSON-RPC connections")
141 ("rpcport", program_options::value<uint16_t>(), "Set port to listen for JSON-RPC connections")
142 ("httpdendpoint", program_options::value<string>(), "Set interface/port to listen for HTTP JSON-RPC connections")
143 ("httpport", program_options::value<uint16_t>(), "Set port to listen for HTTP JSON-RPC connections")
144 ("chain-server-port", program_options::value<uint16_t>(), "Run a chain server on this port")
145 ("input-log", program_options::value< vector<string> >(), "Set log file with CLI commands to execute at startup")
146 ("log-commands", "Log all command input and output")
147 ("ulog", program_options::value<bool>()->default_value(true), "Enable CLI user logging")
148 ("stop-before-block", program_options::value<uint32_t>(), "stop before given block number")
149 ("growl", program_options::value<std::string>()->implicit_value("127.0.0.1"), "Send notifications about potential problems to Growl")
150 ("growl-password", program_options::value<std::string>(), "Password for authenticating to a Growl server")
151 ("growl-identifier", program_options::value<std::string>(), "A name displayed in growl messages to identify this alp_client instance")
152 ;
153 program_options::variables_map option_variables;
154
155 try {
156 program_options::store(program_options::command_line_parser(argc, argv).
157 options(option_config).run(), option_variables);
158 program_options::notify(option_variables);
159
160 } catch (program_options::error& cmdline_error) {
161 std::cerr << "Error: " << cmdline_error.what() << "\n";
162 std::cerr << option_config << "\n";
163 exit(1);

Callers 1

Calls 8

notifyFunction · 0.85
version_infoFunction · 0.85
default_valueMethod · 0.80
implicit_valueMethod · 0.80
storeFunction · 0.50
runMethod · 0.45
whatMethod · 0.45
countMethod · 0.45

Tested by

no test coverage detected