mirror of
https://github.com/boostorg/beast.git
synced 2025-08-02 22:34:32 +02:00
Change implicit_value to default_value
This commit is contained in:
@@ -1,3 +1,9 @@
|
|||||||
|
1.0.0-b17
|
||||||
|
|
||||||
|
* Change implicit to default value in example
|
||||||
|
|
||||||
|
--------------------------------------------------------------------------------
|
||||||
|
|
||||||
1.0.0-b16
|
1.0.0-b16
|
||||||
|
|
||||||
* Make value optional in param-list
|
* Make value optional in param-list
|
||||||
|
@@ -20,34 +20,26 @@ int main(int ac, char const* av[])
|
|||||||
po::options_description desc("Options");
|
po::options_description desc("Options");
|
||||||
|
|
||||||
desc.add_options()
|
desc.add_options()
|
||||||
("root,r", po::value<std::string>()->implicit_value("."),
|
("root,r", po::value<std::string>()->default_value("."),
|
||||||
"Set the root directory for serving files")
|
"Set the root directory for serving files")
|
||||||
("port,p", po::value<std::uint16_t>()->implicit_value(8080),
|
("port,p", po::value<std::uint16_t>()->default_value(8080),
|
||||||
"Set the port number for the server")
|
"Set the port number for the server")
|
||||||
("ip", po::value<std::string>()->implicit_value("0.0.0.0"),
|
("ip", po::value<std::string>()->default_value("0.0.0.0"),
|
||||||
"Set the IP address to bind to, \"0.0.0.0\" for all")
|
"Set the IP address to bind to, \"0.0.0.0\" for all")
|
||||||
("threads,n", po::value<std::size_t>()->implicit_value(4),
|
("threads,n", po::value<std::size_t>()->default_value(4),
|
||||||
"Set the number of threads to use")
|
"Set the number of threads to use")
|
||||||
("sync,s", "Launch a synchronous server")
|
("sync,s", "Launch a synchronous server")
|
||||||
;
|
;
|
||||||
po::variables_map vm;
|
po::variables_map vm;
|
||||||
po::store(po::parse_command_line(ac, av, desc), vm);
|
po::store(po::parse_command_line(ac, av, desc), vm);
|
||||||
|
|
||||||
std::string root = ".";
|
std::string root = vm["root"].as<std::string>();
|
||||||
if(vm.count("root"))
|
|
||||||
root = vm["root"].as<std::string>();
|
|
||||||
|
|
||||||
std::uint16_t port = 8080;
|
std::uint16_t port = vm["port"].as<std::uint16_t>();
|
||||||
if(vm.count("port"))
|
|
||||||
port = vm["port"].as<std::uint16_t>();
|
|
||||||
|
|
||||||
std::string ip = "0.0.0.0";
|
std::string ip = vm["ip"].as<std::string>();
|
||||||
if(vm.count("ip"))
|
|
||||||
ip = vm["ip"].as<std::string>();
|
|
||||||
|
|
||||||
std::size_t threads = 4;
|
std::size_t threads = vm["threads"].as<std::size_t>();
|
||||||
if(vm.count("threads"))
|
|
||||||
threads = vm["threads"].as<std::size_t>();
|
|
||||||
|
|
||||||
bool sync = vm.count("sync") > 0;
|
bool sync = vm.count("sync") > 0;
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user