some simple chances in po_cmdline_helper class
This commit is contained in:
parent
87bb8539b3
commit
41afbe26fb
@ -8,9 +8,9 @@
|
|||||||
namespace po = boost::program_options;
|
namespace po = boost::program_options;
|
||||||
|
|
||||||
|
|
||||||
void po_cmdline_helper::init(boost::program_options::options_description cmdline_desc){
|
void po_cmdline_helper::init(boost::program_options::options_description *cmdline_desc){
|
||||||
|
|
||||||
cmdline_desc.add_options() ("help", "produce help message")
|
cmdline_desc->add_options() ("help", "produce help message")
|
||||||
("version,v", "print the version number")
|
("version,v", "print the version number")
|
||||||
("hostname,h", po::value<std::string>()->default_value("localhost"), "Hostname")
|
("hostname,h", po::value<std::string>()->default_value("localhost"), "Hostname")
|
||||||
("port,p", po::value<int>()->default_value(1883), "Port")
|
("port,p", po::value<int>()->default_value(1883), "Port")
|
||||||
|
@ -8,7 +8,7 @@
|
|||||||
class po_cmdline_helper {
|
class po_cmdline_helper {
|
||||||
|
|
||||||
public:
|
public:
|
||||||
void init(boost::program_options::options_description cmdline_desc);
|
void init(boost::program_options::options_description *cmdline_desc);
|
||||||
|
|
||||||
};
|
};
|
||||||
|
|
||||||
|
8
main.cpp
8
main.cpp
@ -4,6 +4,7 @@
|
|||||||
#include <string>
|
#include <string>
|
||||||
|
|
||||||
#include "POHelperClasses.hpp"
|
#include "POHelperClasses.hpp"
|
||||||
|
#include "POCmdlineHelperClasses.hpp"
|
||||||
#include "MQTTDataStreamer.hpp"
|
#include "MQTTDataStreamer.hpp"
|
||||||
|
|
||||||
#include <boost/program_options.hpp>
|
#include <boost/program_options.hpp>
|
||||||
@ -186,6 +187,8 @@ int main(int argc, char *argv[])
|
|||||||
|
|
||||||
std::string hostname;
|
std::string hostname;
|
||||||
|
|
||||||
|
po_cmdline_helper po_cmdline_inst;
|
||||||
|
|
||||||
boost::program_options::options_description desc_env;
|
boost::program_options::options_description desc_env;
|
||||||
desc_env.add_options() ("path", "the execution path")
|
desc_env.add_options() ("path", "the execution path")
|
||||||
("home", "the home directory of the executing user")
|
("home", "the home directory of the executing user")
|
||||||
@ -217,6 +220,9 @@ int main(int argc, char *argv[])
|
|||||||
|
|
||||||
// set options allowed by the command line
|
// set options allowed by the command line
|
||||||
po::options_description command_line_options("Allowed options");
|
po::options_description command_line_options("Allowed options");
|
||||||
|
|
||||||
|
po_cmdline_inst.init( &command_line_options );
|
||||||
|
/*
|
||||||
command_line_options.add_options() ("help", "produce help message")
|
command_line_options.add_options() ("help", "produce help message")
|
||||||
("version,v", "print the version number")
|
("version,v", "print the version number")
|
||||||
("hostname,h", po::value<string>()->default_value("localhost"), "Hostname")
|
("hostname,h", po::value<string>()->default_value("localhost"), "Hostname")
|
||||||
@ -227,6 +233,8 @@ int main(int argc, char *argv[])
|
|||||||
("deveui", po::value<deveui>(), "DEVEUI")
|
("deveui", po::value<deveui>(), "DEVEUI")
|
||||||
("devkey", po::value<devkey>(), "DEVKEY");
|
("devkey", po::value<devkey>(), "DEVKEY");
|
||||||
|
|
||||||
|
*/
|
||||||
|
|
||||||
// set options allowed in config file
|
// set options allowed in config file
|
||||||
po::options_description config_file_options;
|
po::options_description config_file_options;
|
||||||
config_file_options.add_options() ("APPEUI", po::value<appeui>(), "APPEUI")
|
config_file_options.add_options() ("APPEUI", po::value<appeui>(), "APPEUI")
|
||||||
|
Loading…
Reference in New Issue
Block a user