86 std::pair<boost::optional<boost::program_options::variables_map>,
bool>
main(
87 int argc,
char** argv,
88 const char*
const usage,
89 const char*
const notice,
90 boost::program_options::options_description desc_params,
91 const boost::program_options::positional_options_description& positional_options,
92 const std::function<
void(
const std::string&,
bool)> &print,
93 const char *default_log_name,
97 namespace bf = boost::filesystem;
98 namespace po = boost::program_options;
100 _CrtSetDbgFlag ( _CRTDBG_ALLOC_MEM_DF | _CRTDBG_LEAK_CHECK_DF );
120 po::options_description desc_general(
wallet_args::tr(
"General options"));
133 po::options_description desc_all;
134 desc_all.add(desc_general).add(desc_params);
135 po::variables_map vm;
136 bool should_terminate =
false;
139 auto parser = po::command_line_parser(argc, argv).options(desc_all).positional(positional_options);
140 po::store(parser.run(), vm);
145 Print(print) <<
wallet_args::tr(
"This is the command line electroneum wallet. It needs to connect to a electroneum\n"
146 "daemon to work correctly.") <<
ENDL;
148 Print(print) << desc_all;
149 should_terminate =
true;
155 should_terminate =
true;
162 bf::path config_path(
config);
163 boost::system::error_code ec;
164 if (bf::exists(config_path, ec))
166 po::store(po::parse_config_file<char>(config_path.string<std::string>().c_str(), desc_params), vm);
179 return {boost::none,
true};
181 if (should_terminate)
182 return {std::move(vm), should_terminate};
184 std::string log_path;
194 else if (!log_to_console)
202 Print(print) <<
wallet_args::tr(
"This is the command line electroneum wallet. It needs to connect to a electroneum\n"
203 "daemon to work correctly.") <<
ENDL;
205 Print(print) << desc_all;
206 return {boost::none,
true};
211 return {boost::none,
true};
215 Print(print) << notice <<
ENDL;
225 MINFO(
"Setting log levels = " << getenv(
"ELECTRONEUM_LOGS"));
228 Print(print) << boost::format(
wallet_args::tr(
"Logging to %s")) % log_path;
231 if (lockable_memory >= 0 && lockable_memory < 256 * 4096)
232 Print(print) <<
tr(
"WARNING: You may not have a high enough lockable memory limit")
234 <<
", " <<
tr(
"see ulimit -l")
238 return {std::move(vm), should_terminate};