DynuIPRefresher/src/main.cpp

33 lines
1.2 KiB
C++
Raw Normal View History

2019-05-05 13:38:48 +00:00
#include <iostream>
#include <IPRefresher.h>
2019-10-26 12:41:43 +00:00
#include <Version.h>
#include <Logger.h>
2019-05-05 13:38:48 +00:00
2019-05-06 10:55:01 +00:00
int main(int argc, char *argv[]) {
2019-05-06 16:49:38 +00:00
if (argc > 1) {
2019-05-06 10:55:01 +00:00
std::string firstarg(argv[1]);
2019-05-06 16:49:38 +00:00
if (firstarg == "-h" || firstarg == "--help") {
std::cout << "help page: " << std::endl << "[-h] [--help] print this help page" << std::endl
<< "[-v] [--version] print the software version" << std::endl
<< "[-f] [--force] force refresh of ip" << std::endl
<< "[-l] [--loop] infinite loop to refresh ip every five minutes" << std::endl
2019-05-06 16:49:38 +00:00
<< "[no argument] normal ip check and refresh" << std::endl;
} else if (firstarg == "-v" || firstarg == "--version") {
2019-10-26 12:41:43 +00:00
Logger::message("Version "+Version::VERSION);
} else if (firstarg == "-f" || firstarg == "--force") {
IPRefresher ipr;
ipr.checkIPAdress(true);
} else if (firstarg == "-l" || firstarg == "--loop") {
IPRefresher ipr(true);
2019-05-06 16:49:38 +00:00
} else {
2019-10-26 12:41:43 +00:00
Logger::message("wrong arguments! -h for help");
2019-05-06 10:55:01 +00:00
}
2019-05-06 16:49:38 +00:00
} else {
IPRefresher ipr;
2019-10-26 12:41:43 +00:00
Logger::message("starting check");
ipr.checkIPAdress(false);
2019-05-05 16:50:10 +00:00
}
2019-05-05 13:38:48 +00:00
return 0;
}