pushmsg: Fix required fields.
This commit is contained in:
parent
eac7ab8965
commit
54192f7804
13
pushmsg.cpp
13
pushmsg.cpp
@ -34,9 +34,9 @@ void read_options(int argc, char *argv[])
|
|||||||
("help,h", "Display this help and exit.")
|
("help,h", "Display this help and exit.")
|
||||||
("baseurl", po::value<std::string>()->required(),
|
("baseurl", po::value<std::string>()->required(),
|
||||||
"Example: https://push.example.org")
|
"Example: https://push.example.org")
|
||||||
("token", po::value<std::string>()->required(), "Application token")
|
("token", po::value<std::string>()->required(), "Application token.")
|
||||||
("title", po::value<std::string>()->required(), "Title of the message")
|
("title", po::value<std::string>(), "Title of the message.")
|
||||||
("message", po::value<std::string>(), "Body of the message")
|
("message", po::value<std::string>()->required(), "Message body.")
|
||||||
("priority", po::value<std::int16_t>(),
|
("priority", po::value<std::int16_t>(),
|
||||||
"Priority of the message. Default is 5. "
|
"Priority of the message. Default is 5. "
|
||||||
"0 = no notification, 1-3 = silent, 4-7 = sound, 8-10 = popup.");
|
"0 = no notification, 1-3 = silent, 4-7 = sound, 8-10 = popup.");
|
||||||
@ -58,11 +58,12 @@ void read_options(int argc, char *argv[])
|
|||||||
|
|
||||||
message.base_url = vm["baseurl"].as<std::string>();
|
message.base_url = vm["baseurl"].as<std::string>();
|
||||||
message.token = vm["token"].as<std::string>();
|
message.token = vm["token"].as<std::string>();
|
||||||
message.title = vm["title"].as<std::string>();
|
if (vm.count("title") != 0)
|
||||||
if (vm.count("message") != 0)
|
|
||||||
{
|
{
|
||||||
message.body = vm["message"].as<std::string>();
|
message.title = vm["title"].as<std::string>();
|
||||||
}
|
}
|
||||||
|
message.body = vm["message"].as<std::string>();
|
||||||
if (vm.count("priority") != 0)
|
if (vm.count("priority") != 0)
|
||||||
{
|
{
|
||||||
message.priority = vm["priority"].as<std::int16_t>();
|
message.priority = vm["priority"].as<std::int16_t>();
|
||||||
|
Loading…
x
Reference in New Issue
Block a user